osc/research/cmip6/dl_utils/server_dl.py

13 lines
368 B
Python
Raw Normal View History

2025-05-28 19:16:17 +08:00
import wget
link_file = open("./dl-links.txt", 'r', encoding='utf-8')
link_content = link_file.read().split('\n')
link_file.close()
for link in link_content:
if len(link) > 0:
file_name = link.split('/')[-1]
try:
wget.download(link, out='/download/' + file_name)
except Exception as e:
print(repr(e) + ': ' + link)