0

I'm confused with rsync's exclude.

I'm trying to backup every starting with / but exclude /media/ /mnt/ /home/files/ and /home/backup

sudo rsync -a \
       --progress \
       --stats \
       --exclude-from=/home/files/ \
       --exclude-from=/media/ \
       --exclude-from=/mnt/ \
       --exclude-from=/home/backup/ \
   / /home/backup

Won't work.

I end up copying files to /home/backup/home/backup/... I read that I have to write my excludes relative to my transfer root, but i guess if / is my transfer root then /media/ should be relative to that right?

0

2 Answers 2

4
man rsync

--exclude=PATTERN       exclude files matching PATTERN
--exclude-from=FILE     read exclude patterns from FILE

exclude-from is used to point to a file that lists the folders that you don't want. Try the option --exclude

0
0

Your syntax is incorrect; that's why it isnt't working.

You say:

--exclude-from=/home/backup/

when you should simply say

--exclude="/home/backup/*"

Also, you are not using the

--delete-excluded 

switch that can synchronize the directories.

As to your question at the end: Yes, in your case you are specifying / as your beginning for the rsync. So if you exclude "tmp/*" then it is indeed relative to / so it is the same as specifying "/tmp/*"

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.