import os, shutil
path = r"文件夹路径" # 文件夹路径
data = os.listdir(path)
count = 1
p2 = os.path.join(path,"_{}".format(count))
temp = 0
for i in data:
p1 = os.path.join(path,i)
temp += 1
if not os.path.exists(p2):
os.mkdir(p2)
shutil.move(p1, p2)
else:
shutil.move(p1, p2)
print("move",p1,">>>",p2)
if temp % 5 == 0: # 将5改成需要多少个做成一个文件夹
count += 1
p2 = os.path.join(path,"_{}".format(count))
...小于 1 分钟