0

我有一些简单的代码来导入 Windows 文件路径的 csv 文件,例如"C:/Folder/SubFolder/folder1"将内容和任何子文件夹复制到新目录。

当我运行代码时,我得到了大约 1/3 的样本返回doesn't exist or not a regular file,而另一个则被成功复制。

导致问题的文件是 .docx 或 .pdf,但同样多的文件已成功复制。

在本地 Windows 10 机器上可能导致此问题的原因是什么,如何进一步调试它?

for Submission in FilePaths.itertuples():
    Create the Path
    FolderName = Submission.Group+"-"+Submission.ID+"-"+Submission.FirstName+Submission.Surname
    DestinationPath =DestinationBasePath + Submission.Category+"\\"+ Submission.Value+"\\"+FolderName
    #Copy the source folder tree and contents to the destination 
    try:
        copy_tree(Submission.FullFilePath, DestinationPath,verbose=1)
    except Exception as Ex:
    print(Ex)
    os.listdir(Submission.FullFilePath)
4

1 回答 1

0

我怀疑它与阻止文件被复制的同步或文件锁定问题有关。

于 2020-05-07T14:40:49.893 回答