FileNotFoundError: [WinError 2] The system cannot find the file specified:

As written you’re looking for a file named 0.jpg in the working directory. You want to be looking in the directory you pass in.

So instead do:

os.rename(os.path.join(directory,name), 
    os.path.join(directory,'0'+name))

Leave a Comment