#!/usr/bin/env python
# -*- coding: cp936 -*-
#print "hello"
import os
import time
from collections import deque
sPh=r"D:\b"
tPh=r"D:\a"
def getDirAndCopyFile(sourcePath,targetPath):
if not os.path.exists(sourcePath):
return
#abstargetPath=r"D:\a"
#遍历文件夹
for fileName in os.listdir(sourcePath):
absourcePath = os.path.join(sourcePath,fileName)
#abstargetPath = os.path.join(targetPath, fileName)
if os.path.isdir(absourcePath):
getDirAndCopyFile(absourcePath,abstargetPath)
if os.path.isfile(absourcePath):
递归复制所有文件至同一目录
于 2019-03-04 09:15:46 首次发布