I would like rsync to skip entire directories if they contain a certain file type.
I’m aware of how to exclude files of a certain type. But since I don’t know all the types of files I want to exclude, just that if one type exists the whole dir should be excluded, that is not of much help to me.
I would go this way:
build a file listing all files:
find . > allfilesget the list of directories not to be rsynced. Since you did not specify what is your criterium, let’s assume it is a file suffix like
fopfind . -path '*fop' | xargs -r -n1 dirnamewould give you the list of “forbidden directories”. Here you have to adapt to your case.
then
grep -vthe forbidden directories from the whole file list, building a filtered file listthen rsync with
--files-from=switch using the filtered file list