Skip to content

Instantly share code, notes, and snippets.

@uneasyguy
Created April 21, 2020 05:12
Show Gist options
  • Save uneasyguy/d779755a124299d87575649b83d7b9ac to your computer and use it in GitHub Desktop.
Save uneasyguy/d779755a124299d87575649b83d7b9ac to your computer and use it in GitHub Desktop.
import os
for root, dirs, files in os.walk(os.getcwd(), topdown=False):
for name in files:
if name.endswith(".csv") and name[4:7] == "-9-":
new_name = name.replace("-9-","-09-")
old_filepath = os.path.join(root, name)
new_filepath = os.path.join(root, new_name)
command = f'mv {old_filepath} {new_filepath}'
os.system(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment