34 lines
675 B
Python
Executable File
34 lines
675 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# bulk file renamer that you interface with using intermediary text file.
|
|
|
|
import os
|
|
|
|
def setup_file():
|
|
files = open('files.txt', 'w')
|
|
|
|
for file in os.listdir('.'):
|
|
files.write(file + '\n')
|
|
|
|
def rename_files():
|
|
new_names = open('files.txt', 'r')
|
|
|
|
for file in os.listdir('.'):
|
|
new_name = str(new_names.readline()).rstrip('\n')
|
|
|
|
if (new_name == file) or new_name == "files.txt":
|
|
continue
|
|
|
|
os.rename(file, new_name)
|
|
|
|
print("bulk renamer by Olari.\n")
|
|
|
|
print("Generating files.txt")
|
|
print("Modify it to rename files\n")
|
|
setup_file()
|
|
|
|
input("Waiting for input...\n")
|
|
|
|
print("Renaming files")
|
|
rename_files()
|