Initial
This commit is contained in:
33
python/bulk_renamer.py
Executable file
33
python/bulk_renamer.py
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/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()
|
||||
Reference in New Issue
Block a user