Skip to content

Instantly share code, notes, and snippets.

@naojitaniguchi
Created October 12, 2015 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naojitaniguchi/46ca96cca849dcea3641 to your computer and use it in GitHub Desktop.
Save naojitaniguchi/46ca96cca849dcea3641 to your computer and use it in GitHub Desktop.
Select file from image sequence and rename copy to destination directory .
__author__ = 'tani'
import shutil
if __name__ == '__main__':
start = 1
end = 1324
step = 5
copy_from = "form/"
copy_to = "to/"
in_filename_head = "out_"
out_filename_head = "item_00_"
file_step = (end / 360.0)
count = 360 / step
# print file_step
for i in range(0, 360, step):
seq_number = int(i * file_step)
in_file_seq = "{0:0>4}".format(seq_number+1)
out_file_seq = "{0:0>4}".format(i/step)
copy_from_filename = copy_from + in_filename_head + in_file_seq + ".jpg"
copy_to_filename = copy_to + out_filename_head + out_file_seq + ".jpg"
shutil.copyfile(copy_from_filename, copy_to_filename)
print copy_from_filename + " to " + copy_to_filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment