Last active
February 22, 2021 11:02
-
-
Save satyamkapoor/aeca9670cd6e50be2c9847b1f143dd23 to your computer and use it in GitHub Desktop.
Quickly download all files from a link on NCBI.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wget | |
from urllib.error import HTTPError | |
url = 'https://ftp.ncbi.nlm.nih.gov/repository/dbEST/dbEST.reports.000000.' | |
for x in range(2, 6): | |
fullurl = url + str(x) + '.gz' | |
print(fullurl) | |
try: | |
wget.download(url, '/Users/satk/fasta/') | |
except HTTPError as err: | |
if err.code == 404: | |
print(fullurl + "doesn't exist") | |
else: | |
print(err) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment