我正在尝试将 tif 文件从包含硬盘驱动器上各种文件夹的各种文件夹复制到新位置,但出现错误 到目前为止我的代码是
location = (r'D\Folder\subfolder\[1] subsubfolder\photos\Montage')
dest = (r'D\Folder\subfolder\[1] subsubfolder\')
keyword = 'Red_'
for subdir, dirs, files in os.walk(source):
for file in files:
if keyword in file and file.endswith(".tif"):
try:
shutil.copytree(os.path.join(location, file), os.path.join(dest, file))
print("File copied Succesfully")
except shutil.SameFileError:
print("Source and destination respresents the same file.")
except PermissionError:
print("Permission denied.")
except:
print("Error occured while copying files.")
复制所有文件时出现错误。
为什么我会收到这个错误: