我需要将文件从一个目录及其子目录复制到一个唯一的目标目录,而不需要复制源目录的树结构(这意味着将文件混合在一起)。你知道吗
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import shutil
src = '/Users/wiltomap/Desktop/depart/paquet'
dest = '/Users/wiltomap/Desktop/arrivee'
for dir, subdir, files in os.walk(src):
for f in files:
shutil.copy(f, dest)
…代码不起作用!以下是我在终端中运行它得到的信息:
IOError: [Errno 2] No such file or directory: 'paquet1.rtf'
“paquet1.rtf”是存在于子目录“/paquet/paquet1/”中的文件。你知道吗
谢谢你的帮助!你知道吗
所以也许像是…:
相关问题 更多 >
编程相关推荐