Using Rsync Do Compress Whole Directory During Copy

Using Rsync Do Compress Whole Directory During Copy

Files, Folders, Sub folders from system1 are successfully copying to system2 using below command

rsync -avzP -u -v -e ssh /opt/lampp/htdocs/files/* demo@192.168.157.130:~/files_backup

I need to compress the whole folder "files" during copying. It means I need only compressed file

Any help will be highly appreciable

Regards

1

1 Answer

rsync is using compression during the transfert, if you are not doing differential backups, you can use tar to compress before and scp to transfert the compressed files directory.

cd /opt/lampp/htdocs/files/
tar czvf ../files.backup.tar.gz .
cd ..
scp /opt/lampp/htdocs/files.backup.tar.gz demo@192.168.157.130:~/files_backup
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.