Created
January 21, 2015 09:16
-
-
Save bugparty/61af8f9fd94d2afb257f to your computer and use it in GitHub Desktop.
从目录内搜集wmv文件并移动到根目录的脚本
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
import os | |
import shutil | |
cw = os.getcwd() | |
things =os.listdir(cw) | |
for thing in things: | |
filepath = os.path.join(cw,thing) | |
if os.path.isdir(filepath): | |
files = os.listdir(filepath) | |
for file in files: | |
if file.endswith('.wmv'): | |
shutil.move(os.path.join(filepath, file), | |
os.path.join(cw,file)) | |
print 'moving from'+os.path.join(filepath, file)+'to' + os.path.join(cw,file) | |
#filepath = filepath.decode('gbk') | |
os.removedirs(filepath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment