[melbourne-pug] os.walk into a skip
Mike Dewhirst
miked at dewhirst.com.au
Wed Mar 3 06:09:03 CET 2010
Hi all
Can someone tell me how to skip some arbitrary directories in os.walk()?
for dirpath, dirnames, filenames in os.walk(self.startin, topdown=True):
# do stuff
stuff = test file access times in a fairly deep and widespread directory
tree and relocate files to another root if they fit a preset age pattern.
I now want to interfere with os.walk - I thought by recognising a flag
file in any directory eg., skipthis.dir, and doing this ...
for dirpath, dirnames, filenames in os.walk(self.startin, topdown=True):
if 'skipthis.dir' in filenames:
continue
# do stuff
... but that doesn't work. I'm missing something. I'll plug away for a
bit but if anyone has any ideas I'd be very appreciative.
Thanks
Mike
More information about the melbourne-pug
mailing list