Refactor find_files to use os.walk instead.

This commit is contained in:
2010-01-26 14:09:09 +00:00
parent 777853bd86
commit 930d3bb958

View File

@@ -30,14 +30,11 @@ def find_files(args):
files within) files within)
""" """
filelist = [] filelist = []
for cfile in args:
if os.path.isdir(cfile): for root, dirs, files in os.walk(args, topdown=False):
for sf in os.listdir(cfile): for name in files:
newpath = os.path.join(cfile, sf) filelist.append(os.path.join(root, name))
if os.path.isfile(newpath):
filelist.append(newpath)
elif os.path.isfile(cfile):
filelist.append(cfile)
return filelist return filelist