Skip to content

Instantly share code, notes, and snippets.

@renexdev
Created May 4, 2016 17:31
Show Gist options
  • Save renexdev/95ee96b9137673e4e7b812afe8ff5222 to your computer and use it in GitHub Desktop.
Save renexdev/95ee96b9137673e4e7b812afe8ff5222 to your computer and use it in GitHub Desktop.
Rename files implemented in pulse files
#!/usr/bin/env python
##################################################################################
# Rename files
# Rel. 05/2016
# Dr. Rene Cejas Bolecek
# Low Temperatures Laboratory, CAB, Argentine.
# email: reneczechdev@gmail.com
######
import glob
import shutil
files = files = glob.glob('*.dat*')
for f in files:
original = f
y = f.split('.dat')
print y[0]
print y[1]
intval = int(y[1])
shutil.move(f, y[0]+'_%.02d'%(2*intval+1)+'.dat')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment