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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like