如下所示:
import os
import shutil
#path of imgr
path = 'D:\\BaiduNetdiskDownload\\newim\\'
#path of folder
folderPath = 'D:\\BaiduNetdiskDownload\\folderSort\\'
peopleNumber = 61
#new 61 folder numbers as sort_folder_number[61]
sort_folder_number = [x for x in range(0,peopleNumber)]
# makedir 61 folders
'''
demo功能说明:
在folderPath处新建60个文件夹,
图片存储在path处
给每个文件夹分配150张图片(将9000张图片平均分配到60个文件夹)
Tips:
1: os.path.join(path1,path2...)
this function is used to combine the path,it returns a path which is 'path1/path2...'
2: os.makedirs(path)
this function is used to make a directory(new folder) in the path param
3: shutil.move(oldPath,newPath)
this function is used to move file from param1 to param 2