https://www.linuxtechi.com/rsync-command-examples-linux/
Copy the directory structure of “/home/myhome” from local machine to remote machine (192.168.10.10) under /opt folder.
root@gateway ~]# rsync -av -f"+ */" -f"- *" /home/myhome root@192.168.10.10:/opt/ root@192.168.10.10's password: building file list ... done ……………………………………………… myhome/ sent 43 bytes received 19 bytes 17.71 bytes/sec total size is 0 speedup is 0.00
if I were transferring the files as user labo one method I could use is:
rsync –azv ssh labo@srv1:/opt/webspshere/ /opt/websphere
Sync and remove on target files not present on source
rsync –azvh --delete --progress /opt/webspshere/ srv1:/opt/websphere >> logfile 2>&1
Include and Exclude files during synchronization with rsync,copy the files of type pdf and rpm and exclude png file types.
[root@gateway ~]# rsync -avz -e ssh --include '*.pdf *.rpm' --exclude '*.png' /home/aaa/techi root@192.168.1.29:/opt
View the difference in files & directories between source and destination
[root@gateway ~]# rsync -avzi /home/pkumar/techi root@192.168.1.29:/opt root@192.168.1.29's password: sending incremental file list .d..t...... techi/ <f.st...... techi/projects.txt