url_files_download

cosmo_utils.utils.web_utils.url_files_download(url, ext, outdir, check_exist=False, create_dir=False, remove_files=False, bar_opt='tqdm')[source] [edit on github]

Downloads the files from a URL to a local directory. The files that match a specific file extension, ext.

Parameters:

url : str

String of the URL

ext : str

File extension of the files in the URL.

outdir : str

Path to the output directory. This is the directory, to which the files with extensions ext will be saved.

check_exist : bool, optional

If True, it checks for whether or not the file exists. This variable is set to False by default.

create_dir : bool, optional

If True, it creates the directory if it does not exist. This variable is set to False by default.

remove_files : bool, optional

If True, local files that are present that match the files at the URL will be replaced by the new versions. This variable is set to False by default.

bar_opt : {‘tqdm’, ‘native’}

Option for which type of progress bar to use when downloading files. This variable is set to tqdm by default. Options:

  • ‘tqdm’ : Uses a tqdm-based progress bar
  • ‘native’: Used the wget-based native progress bar.