Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os, sys
- # get args from input sans first item, which is the name of this file
- args = sys.argv[1:]
- # adds missing slash to the end of a string
- def add_end_slash(s):
- if s[-1:] != "/":
- s += "/"
- return s
- folder = add_end_slash(args[0])
- # loop through passed in directory for filenames
- for root, dirs, files in os.walk(folder):
- for name in files:
- filename = os.path.join(root, name).replace(folder, '')
- print "<file href=\"" + filename + "\" />"
Add Comment
Please, Sign In to add comment