Skip to content

Instantly share code, notes, and snippets.

@jktravis
Last active December 16, 2015 08:49
Show Gist options
  • Save jktravis/5408807 to your computer and use it in GitHub Desktop.
Save jktravis/5408807 to your computer and use it in GitHub Desktop.
remove spaces and lowercase file names.
import os, argparse
parser = argparse.ArgumentParser(description="Remove spaces from file names and make them lowercase.")
parser.add_argument("file", nargs='+', help="The file to be renamed")
args = parser.parse_args()
for f in args.file:
print "Renaming {} to {}".format(f, f.replace(" ", "_").lower() )
os.rename(f, f.replace(" ", "_").lower())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment