import os import shutil def get_user_input(): big_address = input("请输入大地址: ") move_path = input("请输入移动路径: ") return big_address, move_path def move_incomplete_folders(big_address, move_path): if not os.path.exists(move_path): os.makedirs(move_path) for root, dirs, files in os.walk(big_address): for dir_name in dirs: dir_path = os.path.join(root, dir_name) file_count = len(os.listdir(dir_path)) if file_count != 13: destination = os.path.join(move_path, dir_name) print(f"Moving {dir_path} to {destination}") shutil.move(dir_path, destination) # Only check the immediate subdirectories, not recursively break if __name__ == "__main__": big_address, move_path = get_user_input() move_incomplete_folders(big_address, move_path) print("处理完成。")
标签:同一,big,move,多图,address,path,os,dir From: https://www.cnblogs.com/zly324/p/18215836