osc/research/cmip6/checker/move_copernicius_files.py
2025-05-28 19:16:17 +08:00

19 lines
633 B
Python

import os
import shutil
origin_path = 'G:/jd_data'
if __name__ == "__main__":
count = 0
for file_name in os.listdir(origin_path):
count += 1
path_level = file_name.split(' + ')
level_1_path = 'G:/Copernicus/{}'.format(path_level[0])
level_2_path = level_1_path + '/' + path_level[1]
if not os.path.exists(level_1_path):
os.mkdir(level_1_path)
if not os.path.exists(level_2_path):
os.mkdir(level_2_path)
shutil.move('{}/{}'.format(origin_path, file_name), level_2_path)
print("[No. {}] 移动文件 {} 成功".format(count, file_name))