Last active
July 21, 2023 10:11
-
-
Save ppdouble/98bb6b06e7f65b8508d210ee5ec86c82 to your computer and use it in GitHub Desktop.
Copy files from remote host to local machine with specific port using rsync. Alternative of scp. To copy a large number of files from remote.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/9090817/copying-files-using-rsync-from-remote-server-to-local-machine | |
# https://explainshell.com/explain?cmd=rsync+-havzP+-e+%22ssh+-p+%24portNumber%22+user%40remote.host%3A%2Fpath%2Fto%2Fcopy+%2Flocal%2Fpath | |
# copy files from remote host with specific ssh port | |
rsync -havzP -e "ssh -p portNumber" user@remote.host:/path/to/copy /local/path | |
# copy abc into local def | |
rsync -avzP user@remote-host:/source/folder/abc /destinate/folder/def/ | |
# copy the files in abc into local abc | |
rsync -avzP user@remote-host:/source/folder/abc/ /destinate/folder/abc/ |
tar -c <source-dir> | ssh <name>@<host> 'tar -kxzf - -C <target-dir>'
rsync -a --ignore-existing /local/directory/ host:/remote/directory/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/9090817/copying-files-using-rsync-from-remote-server-to-local-machine
https://explainshell.com/explain?cmd=rsync+-havzP+-e+%22ssh+-p+%24portNumber%22+user%40remote.host%3A%2Fpath%2Fto%2Fcopy+%2Flocal%2Fpath