I have a
find command that selects some directories and files to be copied to a different location (with
--parents). What I'd like is for the directories that are output by the
find command to be copied without contents (but they should have the same ownership and mode).
I could limit
find to files only with
-type f or
! -type d, but then directories would be created as needed with the default ownership and mode. If I use the
-r option to
cp, then directories are copied with the right ownership and mode, but also with all their files. Basically, I'd like for directories in the listing to result in copying only the directory metadata without its contents.
How to achieve this?