24 lines
730 B
Python
24 lines
730 B
Python
|
|
import os
|
||
|
|
|
||
|
|
lib_dir = r'\\alex.sl.int\alex-slsync\library\County Record Library'
|
||
|
|
|
||
|
|
for doctype in os.listdir(lib_dir):
|
||
|
|
folder = os.path.join(lib_dir, doctype)
|
||
|
|
|
||
|
|
if os.path.exists(folder) and os.path.isdir(folder):
|
||
|
|
print('Renaming files in %s' % doctype)
|
||
|
|
for old_name in os.listdir(folder):
|
||
|
|
old_path = os.path.join(folder, old_name)
|
||
|
|
|
||
|
|
split_idx = old_name.find('.')
|
||
|
|
new_name = old_name[:split_idx].upper()
|
||
|
|
ext = old_name[split_idx:]
|
||
|
|
|
||
|
|
new_name += ext
|
||
|
|
new_path = os.path.join(folder, new_name)
|
||
|
|
os.rename(old_path, new_path)
|
||
|
|
print(' Renamed %s to %s' % (old_name, new_name))
|
||
|
|
|
||
|
|
print('Done renaming files in library')
|
||
|
|
|