In version 0.5 we added the ability to download files and folders using jotta-cli.

jotta-cli download Archive/folder/subfolder ~/Downloads

Above is the syntax for starting a download.  Archive/folder/subfolder is the remote path to the file or folder on jottacloud.  ~/Downloads is the download destination where the files and folders will be downloaded to. 

NB: If you are running jottad  and jotta-cli  on separate devices, you must specify a valid download destination  on the device where jottad  is running.


Command overview

jotta-cli download remote/path /local/download/destination [--merge]
jotta-cli observe --downloads
jotta-cli observe --downloadid=downloadid
jotta-cli download --abort=downloadid
jotta-cli download --retry=downloadid
jotta-cli list downloads
jotta-cli list downloadinformation --downloadid=downloadid [--json]


Starting a download

Understanding and finding the correct remote path to download is perhaps the most confusing thing about downloading using jotta-cli .

As on the website your files are grouped in "Sync", "Backup" and "Archive". See example below: 

jotta-cli download Backup/MyImac/FolderWithStuff ~/Downloads
jotta-cli download Sync .

The correct remote-path can be deduced from the file or folders location on the webpage but the intended method is to use bash-completion on MacOS and linux and jotta-cli ls on windows. See Bash-completion below. 

Once you have pressed return jotta-cli  waits while jottad  gathers the metadata necessary to perform the download. During this time you can abort the download using CTRL-C. Once the download starts jotta-cli prints some information about the download, including a downloadid , and returns.

Cancelling a download

Once a download is started,  you can cancel it by calling
 jotta-cli download --abort=downloadid. You can find the downloadid by calling jotta-cli list downloads. When you cancel a download it leaves any files already succesfully downloaded on the filesystem. Any partially downloaded files are deleted.

Observing a download

You can watch the progress of a download using jotta-cli observe --downloads


Only one download will run at any time. If you have started multiple downloads the second will not start until the first has finished. Once a download completes it disappears from jotta-cli list downloads except if one or more files failed to download.

Download errors 

If a file could not be downloaded for any reason the download will complete, but it will not dissappear from jotta-cli list downloads. To see detailed information about the download errors call jotta-cli list downloadinfo --downloadid=downloadid. You can also add --json to get error information in json format.  

To clear a download from the list call jotta-cli download --abort=downloadid.

Retrying failed downloads

To retry all the failed files for a download call

jotta-cli download --retry=downloadid

Update a previously downloaded folder

If you have updated the version of a folder on the server you can download only the new and updated files by calling

jotta-cli download /same/remote-path/as/lasttime /same/local-path  --merge 

Any files that would have been downloaded but are found locally are checksummed to verify that the correct file already exists and if it exists it is not downloaded again.

This can be io intensive and if you are confident that the files are unchanged locally you can indicate that you want a lighter verification.

jotta-cli download /same/remote-path/as/lasttime /same/local-path  --merge --mergemode=metadata

When mergemode=metadata only the filename, size, and modified date are used to verify the local file before skipping the download

Downloading into stdout

The output of a download can be sent to stdout and piped into wherever is desired:

jotta-cli download -O Archive/filename.txt > localfile.txt

Bash-completion

On MacOS and linux you can use bash completion to 'browse' the remote paths on jottacloud. Try the following:

jotta-cli download [TABTAB]

where [TABTAB] means you press TAB two times.

This should present an experience similar to browsing a local filesytem, though perhaps a bit slower depending on the latency to our servers.  This works with jotta-cli ls [TABTAB]  as well, but not with a leading -l as in jotta-cli ls -l [TABTAB] .

More information: bash completion

If you encounter problems with paths not completing please open an issue on

https://github.com/jotta/jotta-cli-issues or a send a support-ticket to support@jottacloud.com if you do not wish to disclose the filepaths in question publicly.

 


 

Did this answer your question?