I'd recommend these four steps:post
cd ${SOURCE}; find . -type d -exec mkdir -p ${DEST}/\{} \; find . -type f -exec mv \{} ${DEST}/\{} \; find . -type d -empty -delete
or better yet, here's a script that implements semantics similar to mv
:spa
#!/bin/bash DEST=${@:${#@}}; for SRC in ${@:1:$(({#@} -1))}; do ( cd $SRC; find . -type d -exec mkdir -p ${DEST}/\{} \; find . -type f -exec mv \{} ${DEST}/\{} \; find . -type d -empty -delete ) done