Created
December 31, 2011 20:28
-
-
Save daGrevis/1545249 to your computer and use it in GitHub Desktop.
Lists files and directories (like `ls` command does)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os | |
try: | |
root = sys.argv[1]; | |
except IndexError: | |
root = '.' | |
for dirname, dirnames, filenames in os.walk(root): | |
for subdirname in dirnames: | |
print os.path.join(dirname, subdirname) | |
for filename in filenames: | |
print os.path.join(dirname, filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment