Skip to content

Instantly share code, notes, and snippets.

@satyamkapoor
Last active February 22, 2021 11:02
Show Gist options
  • Save satyamkapoor/aeca9670cd6e50be2c9847b1f143dd23 to your computer and use it in GitHub Desktop.
Save satyamkapoor/aeca9670cd6e50be2c9847b1f143dd23 to your computer and use it in GitHub Desktop.
Quickly download all files from a link on NCBI.
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