How to recursively copy directories starting with "abc" on Linux/Unix?
It is possible to use the output of find
with rsync
:
# warning: untestedfind ~/plugins/ -type d -name "abc*" -print0 | rsync -av --files-from=- --from0 ~/plugins/ ~/destination
- the
-print0
infind
, and--from0
inrsync
makes sure that we handle files with spaces correctly - the
--files-from=-
states that we are reading a list of files from stdin