Sonnendach/RenameFiles.py

21 lines
627 B
Python

import os
import shutil
import tkinter
from tkinter import filedialog
root = tkinter.Tk()
print("select List File:")
filename_Filelist = filedialog.askopenfilename()
print("select Directory:")
filename_Directory = filedialog.askdirectory()
root.withdraw
print(filename_Directory)
adress_file = open(filename_Filelist, "r", encoding='utf-8')
address_list = adress_file.read().splitlines()
for adress in address_list:
filenames = adress.split(";")
try:
os.rename(filename_Directory + "/" + filenames[0], filename_Directory + "/" + filenames[1])
except:
print("Failed Renaming File: " + filenames[0])