错误13拒绝权限Python

2024-05-19 17:37:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图编写一个代码来比较目录(子目录和其中的文件),然后将其他目录(仅包括子目录中的文件)的内容复制到其他目录。我把所有东西都进口了然后我就有了这个:

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)

我已经尝试过使用os.listdir的其他路由,但我似乎总是以错误告终

IOError:[Errno 13]权限被拒绝

这是用python 24编写的

我正在使用cygwin运行我的代码,但我是windows用户


Tags: 文件path代码right目录内容onlyfor