This commit is contained in:
GasparVardanyan 2024-09-09 05:41:39 +04:00
parent 997466c962
commit eee76f1731

33
bin/copy.sh Executable file
View 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