update
This commit is contained in:
parent
997466c962
commit
eee76f1731
1 changed files with 33 additions and 0 deletions
33
bin/copy.sh
Executable file
33
bin/copy.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
src=$(realpath "$1")
|
||||
dest=$(realpath "$2")
|
||||
|
||||
pushd "$src" >/dev/null
|
||||
|
||||
dirs=$(find . -type d)
|
||||
|
||||
echo "$dirs" | while read d
|
||||
do
|
||||
mkdir -p -v "$dest/$d"
|
||||
done
|
||||
|
||||
echo "$dirs" | while read d
|
||||
do
|
||||
files=$(find "$d" -type f)
|
||||
|
||||
echo "$files" | while read f
|
||||
do
|
||||
if [ ! -f "$dest/$f" ]
|
||||
then
|
||||
cp -v "$f" "$dest/$f"
|
||||
elif [ "$f" -nt "$dest/$f" ]
|
||||
then
|
||||
cmp -s "$f" "$dest/$f" \
|
||||
|| \
|
||||
cp -v "$f" "$dest/$f"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
popd >/dev/null
|
Loading…
Reference in a new issue