Linux – rsync : Read input from a file and sync accordingly

linuxrsync

I have a text file which contains the list of files and directories that I want to copy (one on a line). Now I want rsync to take this input from my text file and sync it to the destination that I provide.

I've tried playing around with "--include-from=FILE" and "--file-from=FILE" options of rsync but is is just not working

I also tried pre-fixing "+" on each line in my file but still it is not working.

I have tried coming with various filter PATTERNs as outlined in the rsync man page but it is not working.

Could someone provide me correct syntax for this use case. I've tried above things on Fedora 15, RHEL 6.2 and Ubuntu 10.04 and none worked. So i am definitely missing something.

Many thanks.

Best Answer

Can use following with rsync -a option

"--include-from=FILE" and "--from-file=FILE"