Would I be able to use rsync as such:
rsync -e ssh [email protected]:/path/to/file:/path/to/second/file/ /local/directory/
or would i have to do something else?
Rsync is a command-line tool in Linux that is used to copy files from a source location to a destination location. You can copy files, directories, and entire file system and keep in sync the files between different directories. It does more than just copying the files.
The rsync utility must be installed on both the client and server machine before getting started. Rsync has two modes: local and remote. If both machines are on the same network, the local mode is used. This uses minimal transfer security and can rapidly perform transfers and synchronization over LAN.
Rsync creates a directory with the same name inside of destination directory - Server Fault. Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.
To sync the contents of dir1 to dir2 on the same system, you will run rsync and use the -r flag, which stands for “recursive” and is necessary for directory syncing: rsync -r dir1/ dir2.
Directly from the rsync
man page:
The syntax for requesting multiple files from a remote host is done by specifying additional remote-host args in the same style as the first, or with the hostname omitted. For instance, all these work: rsync -av host:file1 :file2 host:file{3,4} /dest/ rsync -av host::modname/file{1,2} host::modname/file3 /dest/ rsync -av host::modname/file1 ::modname/file{3,4}
This means your example should have a space added before the second path:
rsync -e ssh [email protected]:/path/to/file :/path/to/second/file/ /local/directory/
I'd suggest you first try it with the -n
or --dry-run
option, so you see what will be done, before the copy (and possible deletions) are actually performed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With