I am trying to make a basic program to backup one folder from my memory stick when it is plugged in, (I know there are already programs that can do this but that is no fun!) but am having trouble with permissions.
from shutil import copy2
PermissionError: [Errno 13] Permission denied: 'F:/Python/Library'
After trying it myself, I found out the problem. You are using the
shutils.copy2(src, dst) function on a folder, not a file.
src has to be a file. If you are trying to copy a folder to a destination folder, you need to be using
You end up getting the permission error because
shutils.copy2()expects a file.
As for the underlying question of your issue for copying a folder to a destination, please read this for a few different ways to handle this issue.