Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Moving and Deleting Files and Folders (Review Exercises)

mikepalermo88 on Nov. 4, 2023

Sometimes when I want to move folders I recieve the following error:

PermissionError: [WinError 5] Access is denied: 'C:\\Users\\mikep\\my_folder\\image1.png' -> 'C:\\Users\\mikep\\my_folder\\images'

Last time it happened I ran CMD as admin and installed pathlib and shutil, then restarted IDLE as admin and it worked. Next time I tried to use path.replace (in the same admin IDLE instance), it happened again.

Any ideas here?

Become a Member to join the conversation.