0

I am trying to use rsync include-from and exclude-from commands to ignore or only copy listed files/directories from a source. The list is in a text file. For some reason the command does not execute. Why is this the case?

Code:

rsync -ar —exclude-from 'exclude-list.txt' source/* destination/

rsync -ar —include-from 'exclude-list.txt' source2/* destination/

In exclude-list.txt:

file1
file2
/dir1
/dir2
1

1 Answer 1

2

The correct syntax is

rsync -a —exclude-from='exclude-list.txt' source/ destination/

Note the = between the option and the filename.

Also, the --archive (-a) option implies -r, so -r is not needed.

I've also removed * from source/*. The above command will copy all files and directories in or below source to destination (including hidden names), except the things matching the patterns in the exclude file.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .