I have a simple script to pull the latest version of a file down to a local machine. Here's a snippet of the code that is failing.
....
d = "D:\\" + youngest[2]
if os.path.exists(d):
shutil.rmtree(d)
os.mkdir(d)
os.chmod(d, stat.S_IWRITE)
shutil.copyfile(youngest[1] + "/EXE/FILE.EXE", d)
....
The error I'm getting is:
PermissionError: [Errno 13] Permission denied: 'D:\23.5.2.224'
After googling, it seems that os.chmod()
is my ticket to changing permissions of this folder. What am I doing wrong?