Skip to content

Instantly share code, notes, and snippets.

@trigfa
Created December 19, 2013 16:42
Show Gist options
  • Save trigfa/8042299 to your computer and use it in GitHub Desktop.
Save trigfa/8042299 to your computer and use it in GitHub Desktop.
Replaces spaces with underscores in file names. This script takes the directory name as an argument
#!/usr/bin/python
import os
import sys
files = os.listdir(sys.argv[1])
for f in files:
os.rename(f, f.replace(' ', '_'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment