Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

rsync exclude file what given from a find command

OS=lubuntu 20.04.
I will upgrade to 22.04 (is not the question)
I want to backup my $HOME, but there are some files that belongs not to my user

Is it possible to give rsync the output from find and let him exclude that?

My lack on english:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

find $HOME -not -user $USER
/home/alex/initrd.img-5.3.0-53-generic
/home/alex/backup/restricted.pref
skip

Can I give it somehow in this form to rsync? Like from a file?

rsync someoption –exclude /path/to my exclude file

Not I know how to exclude files and folders but I’m a bit lazzy to change my backup-skript for that if it is not necessary.

>Solution :

You can do it in two steps, by redirecting the output of find to a file:

find $HOME -not -user $USER > myExcludeFiles

rsync someoption --exclude-from=myExcludeFiles

From man rsync:

--exclude-from=FILE     read exclude patterns from FILE

Use the full path name to myExcludeFiles when running from cron.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading