Here I present a short python program that prints the list of all files inside the current directory and subdirectories. It prints filename with relative path to the current directory. import os for root, dirs, files in os.walk('./'): for name in files: filename = os.path.join(root, name) print filename You can also print the list of directories only (just print the dirs). Actually I needed this stuff to solve a problem from Google treasure hunt. Let me know if you want me to share the full source code of the solutions of Google treasure hunt. Also share your code, if you have any different idea! Check the python documentation to learn more about processing Files and Directories. Read the full article
Comments (0)
Add Your Comment
Please Enter your Email ID,
to get a new password
Add something
Snip
News
Site
Add Snip
Adding a Snip...
Now you can import your favorite sites to your socialmedian page
Loading...
Loading...
Is this you?
Stats
Mood
0%
Like
0%
Dislike
Share this story
Network
Email
Tweet
Share with the News Network
Email ID's
(multiple Email ID's separated by commas)
Message
Also post this message as a public comment
Don't worry. We won't share the name or email address of the person that you sent the story to.