Toon Pieton wrote: > Hey friendly users, > > Is there any way to get all the txt files in a certain folder and all of > its "sub"-folders? With sub-folder I mean all the folders inside the > previously found folder. Any help would be greatly appreciated
Using the path module from http://www.jorendorff.com/articles/python/path/index.html it's easy: import path basePath = path.path('path/to/root/folder') for txtPath in basePath.walkfiles('*.txt'): # do something with txtPath e.g. list the names print txtPath Otherwise use os.walk() and fnmatch as Tim suggested. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor