[英]Winerror 183 Cannot create a file when that file already exists
so i'm using shutil in python.所以我在python中使用shutil。 What I want to do is move a directory from my onedrive folder, to my Adobe Premeiere projects folder (with the content in the dir).
我想要做的是将一个目录从我的 onedrive 文件夹移动到我的 Adobe Premeiere 项目文件夹(包含目录中的内容)。 When i perform the command "shutil.copytree(src, des)" I get the error:
[Winerror 183] Cannot create a file when that file already exists: 'C:/source'
当我执行命令“shutil.copytree(src, des)”时,出现错误:
[Winerror 183] Cannot create a file when that file already exists: 'C:/source'
There are no folder/file that matches with the tree that I'm copying at the source.没有与我在源处复制的树匹配的文件夹/文件。
Here is my code:这是我的代码:
import os
import shutil
os.chdir("C:/Users/carlh/OneDrive/Gaffla's videor")
video = input("Enter number: ")
def myfunc():
for i in os.listdir():
episod = str(i).split('#')
if episod[1] == video:
print("Success")
print(i)
src = r"C:/Users/carlh/OneDrive/Gaffla's videor/" + i
des = r"D:/PROJECTS/ADOBE_PREMIERE"
shutil.copytree(src, des)
myfunc()
Is there a bug in my code or is there mistake in the explorer?我的代码中是否存在错误或资源管理器中是否存在错误? Please help me to make this work.
请帮助我完成这项工作。 Thanks.
谢谢。
目的地需要是要创建的目录的名称,而不是将在其中创建的父目录。所以你需要:
des = r"D:/PROJECTS/ADOBE_PREMIERE/" + i
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.