【发布时间】:2019-01-02 08:22:17
【问题描述】:
所以我正在使用 Python 中的一个函数,该函数在 Robotframework 中被调用,以将文件从源复制到目标 我已经使用 os.path.join() 和 os.listdir() 和 os.path.normpath() 来访问文件夹并使用 shutil 进行复制 但是每次我得到这个错误
WindowsError: [Error 3] The system cannot find the path specified: '\\10.28.108.***\\folder\\folder2\\out/*.*'
我的代码
from pathlib import Path
import shutil
import os
#filename = Path ("\\10.28.108.***\folder\folder2\out\001890320181228184056-HT.xml")
source = os.listdir("\\10.28.108.***\folder\folder2\out")
destination = "\\10.28.108.***\folder\folder2\"
for files in source :
if files.endswith(".xml"):
shutil.copy(files, destination)
【问题讨论】:
标签: python shutil os.path pathlib