Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
23 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,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 | ||
|
||
input = sys.argv[1] | ||
|
||
os.chdir(input) | ||
print 'Please wait - gathering filelist...' | ||
tiffs = glob('*.tiff') + glob('*.dpx') | ||
counter = 0 | ||
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) | ||
|
||
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() |