Last active
August 29, 2015 14:01
-
-
Save findix/c27ecc0899861e5a27f1 to your computer and use it in GitHub Desktop.
遍历目录获取所有文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import os.path | |
import shutil | |
#需要遍历的目录 | |
fromDir='.\\' | |
#文件汇总到的目录 | |
toDir='..\\result\\' | |
list_dirs = os.walk(fromDir) | |
for root, dirs, files in list_dirs: | |
for f in files: | |
print os.path.join(root, f) | |
# shutil.copy(os.path.join(root, f), toDir+f) | |
print "All Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment