lair.records.ftp_download#

lair.records.ftp_download(host, paths, download_dir, username='anonymous', password='', prefix=None, pattern=None)[source]#

Recursively download files from an FTP server.

Parameters:
  • host (str) – The FTP server host.

  • paths (str | list[str]) – The path(s) to download from the FTP server.

  • download_dir (str) – The local directory to download files to.

  • username (str, optional) – The username to use for the FTP server. Defaults to ‘anonymous’.

  • password (str, optional) – The password to use for the FTP server. Defaults to ‘’.

  • prefix (str, optional) – The common prefix to use for the local directory structure. Defaults to None.

  • pattern (str, optional) – Only download files whose remote path matches. With wildcards (*, ?, [) it is a glob against the full remote path (e.g. '*2015-06*.nc'); otherwise any path containing it matches. Defaults to None (all files).

Returns:

bool – True if the download was successful, False otherwise.