for root, dirs, files in os.walk(path, topdown=True):
file_skip_list = ['file1', 'file2'] dir_skip_list = ['dir1', 'dir2']
for f in files: if f in file_skip_list files.remove(f)
for d in dirs: if d in dir_skip_list: dirs.remove(d)
NOW, ANALYZE THE FILES
And This:
files = [f for f in files if f not in file_skip_list] dirs = [d for d in dirs if dir not in dir_skip_list]
NOW, ANAYLZE THE FILES
The problem I run into is that some of the files and dirs are not removed while others are. I can be more specific and give exact examples if needed. On WinXP, 'pagefile.sys' is always removed, while 'UsrClass.dat' is *never* removed, etc.
--
http://mail.python.org/mailman/listinfo/python-list