I am trying to find out if there is ways to convert a long list of rsync
exclude patterns, that I am maintaining for the purpose of making sensible backups, to an explicit list of file and directory names.
The application is that I am trying to use the same list (whenever I update it by adding or removing a pattern) for a different application (mksquashfs
). Both tools allow explicit file lists with one entry per line to be specified as exlude list, but the syntax for the patterns differs in details.
You may assume that the list to be converted consists of all kinds patterns, possibly including wildcards, allowed by rsync
.
Two approaches are conceivable:
- Find out what
rsync
uses under the hook (it seems to be neither simple shell globbing norfind
) - Use
rsync
to produce the list by doing a--dry-run
dummy transfer with verbose output (here I am not sure how to have it print the names of the excluded files)
Best Answer
Something like this: where
"${other_opts[@]}"
indocates your normal rsync arguments.Should print out all the excluded files.
you can chop that up using sed.
but this might break if you encounter filenames that contain control characters.