I’ve been using rsync in a script one directory at a time, which is fine, but it would be more compact if I can get rsync to read the necessary directories/files from a file and the man pages offer the –files-from=FILE option. Unfortunately I can’t get this to work and the response is: rsync error: syntax or usage error (code 1) at options.c(2308) [client=3.1.1]
My statement might be something like: rsync -a --files-from=dir-list.txt /media/keith/BACKUP_USB
Found it!
The trick is: “Note that you still have to specify the directory where the files listed are located, for instance: rsync -av --files-from=file-list . target/ for copying files from the current dir.”
Note the dot (" . ") between “-list” and “target”. Not obvious from the man pages!
If you want rsync to run on specific directories then (instead of specific files) then you might be better off with --include-from option.
The manpage says:
–include=PATTERN
This option is a simplified form of the --filter option that
defaults to an include rule and does not allow the full
rule-parsing syntax of normal filter rules.
See the FILTER RULES section for detailed information on this
option.
–include-from=FILE
This option is related to the --include option, but it specifies
a FILE that contains include patterns (one per line). Blank
lines in the file and lines starting with ’;’ or ’#’ are
ignored. If FILE is -, the list will be read from standard
input.
So your dir-list.txt could contain:
/Desktop
/Documents
/Pictures
/Misc
/play
/Programming
/Radio
Many thanks for your very detailed reply, SeZo.
I do struggle to understand the man pages so your example is very helpful. I shall practice for a while and report on progress.