Nothing happens on function rename shutil / copy in tkinter

Viewed 6

I'm working on a function who copy and changes the name of files from a specific path. I'm trying to call after this funtion to my tkinter program.The thing is it doesn't work. What i did wrong?

import shutil
import os




def rename():

    Results = r"C:\\2022\\Python program\\Bloc1\\Prediction bloc1\\Results"

    Renamed = r"C:\\2022\\Python program\\Bloc1\\Prediction bloc1\\Renamed"

    src_files=os.listdir(Results)

    for file_name in src_files:
        full_file_name = os.path.join(Results, file_name)
    
        if os.path.isfile(full_file_name):
        
            shutil.copy(full_file_name, Renamed)
            
#    return Results

        

########################################################################

    path = os.chdir("C:\\2022\\Python program\\Bloc1\\Prediction bloc1\\Renamed")

    i = 0
    for file in os.listdir(path):
        new_file_name="{}.jpg".format(i)
        os.rename(file, new_file_name)
    
        i = i+1
0 Answers
Related