Error 13 Permission Denied Python

2019-06-02 17:12发布

问题:

I am trying to write a code to compare directories (sub directories and files within), then copy the contents of the other directory (files only including files in the sub-directories) to the other directory. I imported everything then I have this:

dst = "C:/somefolder" 
path = "C:/otherplace"
compare = filecmp.dircmp(path,dst)
ans = compare.right_only 
for fil in ans:
  if len(ans)>0:
    shutil.copy2(dst,path)

i have tried other routes using os.listdir but i always seem to end up at the error

IOError: [Errno 13] Permission denied

this written in python 24

I am running my code using cygwin but i am a windows user