rsync – we synchronize files from the computer to the server

How to transfer (synchronize) files from a directory on a Mac OS computer to a remote server via bash script.

To transfer files with synchronization, the following command is suitable:

rsync -avz ~/Sites/ploshadka.net/files/ * root@111.111.111.111:/home/admin/sites/ploshadka.net/files/

Note that there is a colon after the IP address.

You can also delete files beforehand DS_Store:

find ~ / Sites / ploshadka.net / files -name ‘* .DS_Store’ -print0 -delete

Or transfer file extensions by mask * .txt as in the command below.

To transfer without synchronization, you can use the command scp:

scp -r ~/Sites/ploshadka.net/files/ *.txt ssh root@111.111.111.111:/home/admin/sites/ploshadka.net/files/

^ I don’t remember exactly, but it seems like it’s possible without the word ssh.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *