From: Michael Wagner Date: Fri, 23 Feb 2018 21:42:11 +0000 (+0100) Subject: posaune X-Git-Tag: sysd2sysv_0.1-1~5 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c5b94969086dca212584d755f6a1371032a7492b;p=projects.git posaune --- diff --git a/tools/make/treecopy b/tools/make/treecopy new file mode 100755 index 0000000..761bd87 --- /dev/null +++ b/tools/make/treecopy @@ -0,0 +1,34 @@ +#!/bin/bash + +# copy all files below ($1), that match ($3) +# into target ($2) + +function fcp +{ + rel_path=${3#$1} + + # create target dir, if necessary + rel_dir=${rel_path%/*} + mkdir -p $2/$rel_dir + cp -a $1/$rel_path $2/$rel_dir +} + +usage="usage: treecopy |-e" + +if [ $# -ne 3 ] +then + echo $usage + exit 1 +fi +if [ $3 == "-e" ] +then + for file in $(find $1 \( -type f -o -type l \) -executable) + do + fcp $1 $2 $file + done +else + for file in $(find $1 \( -type f -o -type l \) -name "$3") + do + fcp $1 $2 $file + done +fi