Esempio n. 1
0
#!/usr/bin/python
import os
import sys
from filehandler import directory_scanner

dirtoscan = '.'
if (len(sys.argv) > 1):
    dirtoscan = sys.argv[1]

if  (not os.path.isdir(dirtoscan)):
    sys.exit(1)
a = directory_scanner(dirtoscan)
x = a.get_file_list(False)
for a in x:
    print a
Esempio n. 2
0
#/usr/bin/python
import sys
import os
from filehandler import directory_scanner, compare_directory, file_util

if (len(sys.argv) != 3 or (sys.argv[1] == sys.argv[2]) or ( not os.path.isdir(sys.argv[1]) ) \
        or (not os.path.isdir(sys.argv[2] ))):
    print "#### Usage: " + sys.argv[0] + " first_dir  second_dir"
    print "#### I compare two directories, exiting... "
    sys.exit(1)

dirsc = directory_scanner(sys.argv[1])

### reject files from SCCS directory, and files with extns .o. Accept files with
### .cc,.cpp,.c,.h,.hpp,.mk, Makefile for comparison

dirsc.add_reject_filter('SCCS')
dirsc.add_reject_filter('\.o$')
dirsc.add_reject_filter('\.pyc$')

dirsc.add_accept_filter('\.py$')
dirsc.add_accept_filter('\.cpp$')
dirsc.add_accept_filter('\.cc$')
dirsc.add_accept_filter('\.h$')
dirsc.add_accept_filter('\.hpp$')
dirsc.add_accept_filter('\.mk$')

fileset1 = dirsc.get_file_list(True)

dirsc.set_root_dir(sys.argv[2])
fileset2 = dirsc.get_file_list(True)
if (len(sys.argv) < 2 ) :
        print "Usage :" + sys.argv[0] + " directory_1 directory_2 .... "
        sys.exit(1)                                                     

start = 1
dirlist = set()
while ( start < len(sys.argv)) :
        if (os.path.isdir(sys.argv[start]) and (sys.argv[start] not in dirlist) ):
                dirlist.add(sys.argv[start]);                                     
        start += 1                                                                

if (len(dirlist) == 0):
        print "None of the inputs were valid directories , hence exiting...."
        sys.exit(1)                                                          

dirsc = directory_scanner('.')
### reject files from SCCS directory, and files with extns .o. Accept files with
### .cc,.cpp,.c,.h,.hpp,.mk, Makefile for uniqueness checking

dirsc.add_reject_filter('SCCS')
dirsc.add_reject_filter('\.o$')
dirsc.add_reject_filter('\.pyc$')

dirsc.add_accept_filter('\.py$')
dirsc.add_accept_filter('\.cpp$')
dirsc.add_accept_filter('\.cc$')
dirsc.add_accept_filter('\.h$')
dirsc.add_accept_filter('\.hpp$')
dirsc.add_accept_filter('\.mk$')

u_checker = unique_file_checker()
Esempio n. 4
0
#/usr/bin/python                       
import sys                             
import os                              
from filehandler import directory_scanner, compare_directory, file_util

if (len(sys.argv) != 3 or (sys.argv[1] == sys.argv[2]) or ( not os.path.isdir(sys.argv[1]) ) \
        or (not os.path.isdir(sys.argv[2] ))):                                                
        print "#### Usage: " + sys.argv[0] + " first_dir  second_dir"                         
        print "#### I compare two directories, exiting... "                                   
        sys.exit(1)                                                                           


dirsc = directory_scanner(sys.argv[1])

### reject files from SCCS directory, and files with extns .o. Accept files with
### .cc,.cpp,.c,.h,.hpp,.mk, Makefile for comparison                            

dirsc.add_reject_filter('SCCS')
dirsc.add_reject_filter('\.o$')
dirsc.add_reject_filter('\.pyc$')

dirsc.add_accept_filter('\.py$')
dirsc.add_accept_filter('\.cpp$')
dirsc.add_accept_filter('\.cc$') 
dirsc.add_accept_filter('\.h$')  
dirsc.add_accept_filter('\.hpp$')
dirsc.add_accept_filter('\.mk$') 


fileset1 =  dirsc.get_file_list(True)
Esempio n. 5
0
#!/usr/bin/python
import os
import sys
from filehandler import directory_scanner

dirtoscan = '.'
if (len(sys.argv) > 1):
    dirtoscan = sys.argv[1]

if (not os.path.isdir(dirtoscan)):
    sys.exit(1)
a = directory_scanner(dirtoscan)
x = a.get_file_list(False)
for a in x:
    print a