check_download_file, remotepath, download_dir, remotename=None, replace=False)[source] [edit on github]

Downloads a file from a remotepath to a localpath if it isn’t there.

This function checks whether a file with name filename exists in the user’s local machine. If it doesn’t, it downloads the file from remotepath.

  • filename (str) – Name of file.

  • remotepath (str) – URL of the remote location from which filename can be downloaded.

  • download_dir (str) – The files directory.

  • remotename (str, optional) – Filename under which the file is stored remotely. Default is same as filename.

  • replace (bool, optional) – If True, file will be downloaded whether or not file already exists locally.


>>> from import check_download_file
>>> remotepath = ""
>>> check_download_file("filename.txt", remotepath, download_dir='.')  # doctest: +SKIP