Last active
April 27, 2017 09:55
-
-
Save slv922/77f9a21b45f58f07d6270badd61e87fd to your computer and use it in GitHub Desktop.
搬移某目錄中的大量檔案到多個目錄並控制每個目錄中的檔案數量
This file contains hidden or 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
from glob import glob | |
import os | |
filelist=glob('MSGS/00/*') | |
# folder number | |
for i in range(900): | |
#os.system("mkdir %03d" %i) | |
print("mkdir %03d" %i) | |
#file number in folder | |
for j in range(10000): | |
try: | |
file=filelist.pop(0) | |
except: | |
print("file empty, bye!") | |
exit(0) | |
#os.system("mv %s %03d" % (file,i)) | |
print("mv %s %03d" % (file,i)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment