qlmaas.utils.mirror_files

qlmaas.utils.mirror_files(local_dir: str, direction: str, *, force: bool = False)

Synchronize files between a local directory and the remote server.

Depending on the specified direction, this function either uploads all files from the local directory to the server or downloads all files from the server to the local directory.

This function wraps mirror_files() from the underlying QLMaaSConnection.

Warning

Beware, the local_dir cannot have folder in it.

from qlmaas.utils import mirror_files

# Upload in the remote server folder,
# force=True will erase everything inside
# the remote server folder before uploading the files.
mirror_files("folder", "upload", force=True)

# Download in the local folder,
# force=False will check that no files are in the local folder
# before downloading all files from the server side
mirror_files("folder", "download", force=False)
Parameters:
  • local_dir (str) – path to the local directory.

  • direction (str) –

    direction of the synchronization:

    • "upload" (to create a copy of the local directory on the server)

    • "download" (to create a local copy of the files stored on the server)

  • force (bool, optional) – if True, erase every existing files on the destination side. Defaults to False.