added RenameFiles.py

This commit is contained in:
schrom01 2022-04-13 16:48:17 +02:00
parent aed4258811
commit 7a3ba625d3
2 changed files with 21 additions and 16 deletions

21
RenameFiles.py Normal file
View File

@ -0,0 +1,21 @@
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])

View File

@ -1,16 +0,0 @@
import os
import shutil
import tkinter
from tkinter import filedialog
root = tkinter.Tk()
print("select File:")
filename_Filelist = filedialog.askopenfilename()
root.withdraw
adress_file = open(filename_Filelist, "r")
address_list = adress_file.read().splitlines()
for adress in address_list:
filenames = adress.split(";")
os.rename(filenames[0], filenames[1])