forked from Irish-Film-Institute/IFIscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatchrename.py
More file actions
executable file
·32 lines (27 loc) · 854 Bytes
/
batchrename.py
File metadata and controls
executable file
·32 lines (27 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
'''
Very quickly written script to rename part of an image sequence's filenames.
'''
import os
import sys
from glob import glob
def main():
'''
Asks user what they'd like their image sequence renamed to.
'''
source = sys.argv[1]
os.chdir(source)
print 'Please wait - gathering filelist...'
tiffs = glob('*.tiff') + glob('*.dpx')
filename = tiffs[0]
# create new variable which trims the first 18 characters.
head_good_filename = filename[:-11]
print 'Current filename without extension and number sequence is: %s' % head_good_filename
new_head = raw_input('what do you want to change this to?\n')
for i in tiffs:
tail = i[-11:]
filename_fix = new_head + tail
print filename_fix
os.rename(i, filename_fix)
if __name__ == '__main__':
main()