Skip to content

Instantly share code, notes, and snippets.

@gregneagle
Created April 9, 2015 17:40
Show Gist options
  • Save gregneagle/8697d7ed2c462bc88391 to your computer and use it in GitHub Desktop.
Save gregneagle/8697d7ed2c462bc88391 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import os
some_dir = "/Users/Shared/temp"
for filename in os.listdir(some_dir):
name, ext = os.path.splitext(filename)
new_name = name[0:29] + ext
os.rename(os.path.join(some_dir, filename), os.path.join(some_dir, new_name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment