I want to copy a list of files and folders from a source directory structure to a destination directory. The directory structure shall remain intact. I want to filter the source directory tree using wildcards, but the filter may contain partial paths with folders, files and wildcards. Basically, I want to achieve something similar to this beautiful and efficient bash snippet:
echo "\
CMake/somefilepattern* \
include/somefile.h \
source/somefolder/* \
" | tr -s " " "\n" | rsync -amv --include="*/" --include-from=- --exclude="*" "/path/to/source/" "/path/to/destination/"
Just in powershell (7.x). All my attempts with Copy-Item and -Filter or -Include failed because these parameters do only work on filenames.