Issue
I’ve been working on a project for a few days and I make a lot of changes to the code, so I thought I’d make a backup using a script: Here’s how it looks;
import shutil
shutil.copy('C:\\Coding', 'F:\\My Backups')
print("Backup Successfully created!")
I wanna copy the folder in which my code is there and then paste it in ‘F:\My Backups’. but it gives Permission Denied, I tried taking ownership of the two folders, One in C drive and another in F drive..
I tried using it in Admin CMD and Powershell, But what it does is, It runs the code again from start and then it quit itself..
Any Help is appreciated!!
Solution
shutil.copy
expects the first argument to be a file. It can’t copy whole folders. Use shutil.copytree
instead.
Answered By – Tim Roberts
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0