breaking stuff with sqlite

This commit is contained in:
Q
2024-09-16 14:15:45 +03:00
parent 71e155fcde
commit 2193eeebd6
5 changed files with 220 additions and 17 deletions

View File

@@ -4,7 +4,7 @@ set -e
function helpexit() {
echo Usage: $( basename "$0" ) [--nc] source [source] target
echo Copy files with a progress bar to a folder.
echo This command always
echo This command always
echo '* recurses to folders!'
echo '* overwrites existing files'
echo '--nc Dont count bytes first'
@@ -21,7 +21,7 @@ for ((i=1; i<=${#@}; i++)) {
}
[[ "${#SRC[@]}" -lt 2 ]] && helpexit
which pv &> /dev/null || { echo No \'pv\' installed; exit 1; }
TGT=${SRC[${#SRC[@]}-1]}
TGT="${SRC[${#SRC[@]}-1]}"
unset 'SRC[${#SRC[@]}-1]'
for path in ${SRC[@]}; do
[[ -e "$path" ]] || { echo $path missing; exit 1; }
@@ -47,9 +47,9 @@ copy_dir() {
chown --reference="$1" "$2"
mysize=$( getsize "$1" )
TGT_ABS=$( abs-path "$2" )
pushd "$1" &> /dev/null
tar -c "." | pv -s $mysize | tar -x --strip-components=1 -C "$TGT_ABS"
popd &> /dev/null
pushd "$1" &> /dev/null
tar -c "." | pv -s $mysize | tar -x --strip-components=1 -C "$TGT_ABS"
popd &> /dev/null
}
copy_to() {
@@ -73,6 +73,6 @@ mkdir -p "$TGT"
for SRC_THIS in "${SRC[@]}"; do
SRC_BASE=$( basename "$SRC_THIS")
echo "$SRC_THIS"
copy_to "$SRC_THIS" "$TGT"/"$SRC_BASE"
copy_to "$SRC_THIS" "$TGT"/"$SRC_BASE"
done