diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2017-12-01 21:08:19 +0100 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2017-12-01 21:08:19 +0100 |
commit | 84e1d4bdacffd429eb29a8186fccb1996a580364 (patch) | |
tree | 99642b57575976698fae5f9e1d36ea4df19e443a |
first rewrite
-rwxr-xr-x | mcp.sh | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -0,0 +1,16 @@ +#!/bin/bash + +cp-dir() { + local SRC="$1" + local DST="$2" + shift 2 + + for DIR in "$@"; do + DSTDIR="${DST}${DIR#$SRC}" + echo mkdir "$DSTDIR" + find "$DIR" -maxdepth 1 -not -type d -execdir sh -c 'echo cp "$@" "$DSTDIR"' -- {} + + done +} +export -f cp-dir + +find tree -type d -print0 | xargs -0 -P 8 bash -c 'cp-dir "$@"' -- tree /tmp/dest |