import sys, os
def processfile ( wparam, dirpath, namelist ):
for name in namelist:
print os.path.splitext ( name ) #os.path.split(name)
"""
for name in namelist:
if os.path.isdir(name):
#we skip folders with _skip
if name.contains ('_skip'):
continue
else:
os.walk.path ( name, processfile, wparam )
print name
"""
def main(argv=None):
print "You can skip directories to be listed by putting _skip in the directory"
#simple check of argument list
if len(argv) < 2:
print "Argument Error: Please the name to be used for document list"
return 0
f = open(argv[1], 'w')
#os.path.walk( os.getcwd() + '/docs', processfile, None )
docs = os.getcwd() + '/docs'
os.walk.path = processfile ( docs, processfile, f )
f.close();
return 1
if __name__ == '__main__':
sys.exit(main(sys.argv))