import os, os.path, glob, shutil
# directory where the files will be iterated over
root_dir = ""
# directory where the files will be moved to
# based on request, this will be same as the root
destination_dir = root_dir
for dir, dirs, files in os.walk(root_dir + "/"):
# only considering cases where directory has more than one entry
# not mentioned in the request, but also considering cases where the only entry is a file
if len(files) == 0 and len(dirs) + len(files) < 2:
continue
curr_dir_basename = os.path.basename(dir)
shutil.move(dir, "%s/%s" % (destination_dir, curr_dir_basename))
아직 간단한 테스트 밖에 안 했는데 한번 써보고 문제 있으면 말해 줘