Skip to content

Instantly share code, notes, and snippets.

@amundo
Created October 20, 2011 04:23
Show Gist options
  • Select an option

  • Save amundo/1300411 to your computer and use it in GitHub Desktop.

Select an option

Save amundo/1300411 to your computer and use it in GitHub Desktop.
Add a prefix to all the filenames in a directory
from glob import glob
import os
files = glob('*.txt')
for file in files:
os.rename( file, 'brad_' + file )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment