Skip to content

Instantly share code, notes, and snippets.

@kieranjol
Last active August 4, 2016 09:04
Show Gist options
  • Select an option

  • Save kieranjol/cd40f53b743c7afbf309d85db68d594f to your computer and use it in GitHub Desktop.

Select an option

Save kieranjol/cd40f53b743c7afbf309d85db68d594f to your computer and use it in GitHub Desktop.
import os
import sys
from glob import glob
input = sys.argv[1]
os.chdir(input)
tiffs = glob('*.tiff')
for i in tiffs:
filename = i
# create new variable which trims the first 18 characters.
filename_fix = filename[18:]
print filename_fix
fix_with = 'ab595_ifard2016104'
new_filename = fix_with + filename_fix
print new_filename
os.rename(filename, new_filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment