Change your initial code to this to start the next set, beginning at 101:
import os
path = os.chdir("D:\\Photos\\Summer")
i = 101
for file in os.listdir(path):
new_file_name = "pic{}.jpg".format(i)
os.rename(file, new_file_name)
i = i + 1
As you can see, changing the variable i
to 101 to begin with will start the naming at "pic101".
To move files:
Begin by creating a directory inside "Pictures" called "SummerAutonamed". Then, in the python file:
for file in os.listdir(path):
filename = file
os.rename(f"D:\\Photos\\Summer\\{filename}", f"D:\\Photos\\Summer_Autonamed\\{filename}")
Put this code after the code that renames all the files. Then, every file will be renamed and then moved to the folder "Summer_Autonamed". It is imperative that the directory "Summer_Autonamed" exists before you run the program.
The completed code should read:
import os
path = os.chdir("D:\\Photos\\Summer")
i = 101
for file in os.listdir(path):
new_file_name = "pic{}.jpg".format(i)
os.rename(file, new_file_name)
i = i + 1
for file in os.listdir(path):
filename = file
os.rename(f"D:\\Photos\\Summer\\{filename}", f"D:\\Photos\\Summer_Autonamed\\{filename}")