Academic Work Personal
|
Python /
Traversing a directory recursively
Migrated to https://pythonadventures.wordpress.com/2011/03/26/traversing-a-directory-recursively/. import os def processDirectory ( args, dirname, filenames ): print dirname for filename in filenames: print " " * 4 + filename, print ";", os.path.splitext(filename) base_dir = "/home/jabba/python" os.path.walk( base_dir, processDirectory, None )
Example output: /home/jabba/python/tutorials tutorial.pdf ; ('tutorial', '.pdf') TutorielPython.pdf ; ('TutorielPython', '.pdf') |
![]() anime | bash | blogs | bsd | c/c++ | c64 | calc | comics | convert | cube | del.icio.us | digg | east | eBooks | egeszseg | elite | firefox | flash | fun | games | gimp | google | groovy | hardware | hit&run | howto | java | javascript | knife | lang | latex | liferay | linux | lovecraft | magyar | maths | movies | music | p2p | perl | pdf | photoshop | php | pmwiki | prog | python | radio | recept | rts | scala | scene | sci-fi | scripting | security | shell | space | súlyos | telephone | torrente | translate | ubuntu | vim | wallpapers | webutils | wikis | windows Blogs and Dev. * Ubuntu Incident Places Debrecen | France | Hungary | Montreal | Nancy Notes Hobby Projects * Jabba's Codes Quick Links [ edit ] |