From fd828a58211f2833a7e0b67c1daebf6685b9c6db Mon Sep 17 00:00:00 2001 From: ludwig Date: Sun, 10 Jul 2022 11:05:37 -0500 Subject: [PATCH] Upload files to '' Started work on rename segment --- main.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 3de8dda..5c277c2 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,9 @@ -import os +import os, glob def main(): - exts = ('.jpg', '.webm', '.png', '.mp4', '.gif', '.pdf', '.odt') + exts = ('.jpg', '.webm', '.png', '.mp4', '.gif') print("The Source directory is " + os.getcwd()) newdir = str(input("Please enter a directory:")) @@ -18,6 +18,10 @@ def main(): print("Directory found " + os.getcwd()) # file_list=glob.glob('*.png') #checks to see if files are in directory, asks user if they look familiar frecognize(directory, exts) + frename(exts, directory) + #frecognize(directory, exts) + + def frecognize(directory, exts): @@ -31,13 +35,22 @@ def frecognize(directory, exts): #i += 1 -def frename(directory): - str(oldname) +def frename(exts, directory): + filename=[] + source = directory + filename newname = str(input("Please enter the new filename: ")) + index = 0 + for filename in os.listdir(directory): + if glob.glob('*.png') == 1: + pngname = newname + "_" + str(index + 1) + ".png" + os.rename(filename, pngname) + + elif glob.glob('*jpg') == 1: + os.rename(folder, newname + "_" + str(index + 1) + ".jpg") - for file in os.listdir(directory) main() # todo add gui -# todo make frecognize do what the fuck I want it to (print x amount of files) \ No newline at end of file +# todo make frecognize do what I want it to (print x amount of files) +