You can combine this with a copy filter.
https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Copy.htm
See also
https://resource.dopus.com/t/want-to-copy-directories-containing-specific-file-type/37263