Skip to content

Instantly share code, notes, and snippets.

@ejmurray
Created April 2, 2015 14:30
Show Gist options
  • Save ejmurray/718cce11a9d35543d00c to your computer and use it in GitHub Desktop.
Save ejmurray/718cce11a9d35543d00c to your computer and use it in GitHub Desktop.
Rename files using python os command
__author__ = 'Ernest'
import os
for textfiles in os.listdir("."):
if textfiles.startswith("P") and textfiles.endswith('.txt'):
os.rename(textfiles, textfiles.replace("P", "p", 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment