-
Notifications
You must be signed in to change notification settings - Fork 0
/
copyit-p2.py
43 lines (33 loc) · 1.15 KB
/
copyit-p2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import time
import shutil
sourceDir = r"C:\GOPATH\src\github.com\kazarus\KzPack4Go"
targetDir = r"C:\GITHUB\KzPack4Go"
fileCount = 0
def copyFiles(sourceDir, targetDir):
global fileCount
print sourceDir
print u"%s 当前处理文件夹%s已处理%s 个文件" %(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())), sourceDir,fileCount)
for f in os.listdir(sourceDir):
if f ==".git":
continue
sourceF = os.path.join(sourceDir, f)
targetF = os.path.join(targetDir, f)
print sourceF
if os.path.isfile(sourceF):
#创建目录
if not os.path.exists(targetDir):
os.makedirs(targetDir)
fileCount += 1
shutil.copy(sourceF,targetF)
if os.path.isdir(sourceF):
copyFiles(sourceF, targetF)
if __name__ == "__main__":
try:
import psyco
psyco.profile()
except ImportError:
pass
copyFiles(sourceDir,targetDir)