Created
October 21, 2016 23:59
-
-
Save rindeal/4d1dc34a3febf431704b3addd06cb815 to your computer and use it in GitHub Desktop.
mv-merge.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DEST="${@:${#@}}" | |
| ABS_DEST="$(cd "$(dirname "$DEST")"; pwd)/$(basename "$DEST")" | |
| for SRC in ${@:1:$((${#@} -1))}; do ( | |
| cd "$SRC"; | |
| find . -type d -exec mkdir -p "${ABS_DEST}"/\{} \; | |
| find . -type f -exec mv -u \{} "${ABS_DEST}"/\{} \; | |
| find . -type d -empty -delete | |
| ) done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment