commands
get
Download files from the server.
Syntax
Section titled “Syntax”get [switches] <remote-file>... [<local-target>]Copies remote files and directories to the local computer. Directories are copied with everything they contain.
With a single argument, the file lands in the local working directory
(see lcd). With more, the last argument is the target:
- end it with
/to name a directory:/home/alice/backup/; - otherwise its last part is the new file name, or an
operation mask such as
*.bak.
Use ./ as the target to download several files into the local working
directory. The source names may use masks in their last
part. With /stdout, a target of - writes the file to standard output.
Also available as recv, mget.
Switches
Section titled “Switches”| Switch | What it does |
|---|---|
-delete |
Remove each remote file once it has been downloaded, which turns the copy into a move. |
-resume |
Continue an interrupted download where it stopped (SFTP and FTP). |
-append |
Add the downloaded data to the end of an existing local file (SFTP). |
-preservetime[=all] |
Give local files the modification time of the remote ones. With =all, directories keep theirs too. |
-nopreservetime |
Let downloaded files get the current time. |
-speed=<KB/s> |
Cap the download rate in kilobytes per second. |
-transfer=<mode> |
Use binary, ascii (convert line endings) or automatic mode. |
-filemask=<mask> |
Select which files and subdirectories to download with an include and exclude mask. |
-resumesupport=<on/off/KB> |
Download to a temporary file first, always (on), never (off), or for files larger than the number of KB given. |
-neweronly |
Skip files whose local copy is the same age or newer. |
-latest |
Download only the most recently modified of the matching files. |
Affected by
Section titled “Affected by”confirm, failonnomatch, reconnecttime (see option).
Examples
Section titled “Examples”Download one file into a local directory.
get /var/www/html/index.html /home/alice/backup/Move the day’s logs, renaming them on the way.
get -delete /var/log/app/*.log /home/alice/logs/*.oldFetch only the newest dump.
get -latest /srv/backups/*.sql.gz ./