My 2cent tips & tricks on computer technology & Application Virtualization ...
Thursday, July 3, 2008
recursive list files in a dir using Python
use the following code to list the files in a dir tree
import os import sys fileList = [] rootdir = sys.argv[1] for root, subFolders, files in os.walk(rootdir): for file in files: fileList.append(os.path.join(root,file)) print fileList
3 comments:
[...] Original post [...]
Hey, this is simple but perfect..!
This is just what I was looking for! So simple and it works like a charm.. thanks!
Post a Comment