Python way (assuming that all files in the source directory are JPEG images):
Code:
#!/usr/bin/env python
import os
source_dir = '/path/to/source' # substitute actual path to source dir
target_dir = '/path/to/target' # substitute actual path to SD card
file_list = os.listdir(source_dir)
for i in xrange(len(file_list)//99 + 1):
new_dir = ''.join([target_dir, '1', str(i).zfill(2), 'NIN03'])
if not os.path.exists(new_dir):
os.makedirs(new_dir)
for j in xrange(1, 100):
try:
source_name = ''.join([source_dir, file_list[-1]])
target_name = ''.join([new_dir, '/HNI_00', str(j).zfill(2), '.JPG'])
if os.path.isfile(source_name):
os.rename(source_name, target_name)
file_list.pop()
except IndexError:
break
Bookmarks