我有一个与它的子目录结合2文件夹的问题,我有2个文件夹源。我把它命名为:test-2
和test-2
和路径,以这些文件夹是output/test-2
和output/test-4
结合2个目录与它的子目录
我这一行合并它:
merged_folder_path = 'merged/dir/output'
shutil.copy(result_1_path, merged_folder_path)
shutil.copy(result_2_path, merged_folder_path)
但得到错误:
Traceback (most recent call last):
File "jamu.py", line 769, in <module>
main(sys.argv)
File "jamu.py", line 757, in main
shutil.copy(result_1_path, merged_folder_path)
File "C:\Python27\lib\shutil.py", line 119, in copy
copyfile(src, dst)
File "C:\Python27\lib\shutil.py", line 82, in copyfile
with open(src, 'rb') as fsrc:
IOError: [Errno 13] Permission denied: 'output/test-2'
是什么问题我的代码?前复制/移动
这看起来不像Python问题。我怀疑你没有合适的权限来访问你正在移动的目录。如果您使用的是类似unix的系统,请尝试使用'chmod'更改权限。 – ChrisP
我使用Windows的方式, 我有更改权限的目录和子目录与CACLS 与 'CACLS myfoldername/T/E/G所有人:F' 从[这个链接(https://开头的社区。 spiceworks.com/how_to/1638-using-cacls-to-modify-file-folder-permissions-for-users-groups-in-batch-file) 但它仍然不起作用。 – Densus
可能的副本[复制目录到python目录的内容](http://stackoverflow.com/questions/15034151/copy-directory-contents-into-a-directory-with-python) – Oin