toys fixes

checkmissing: add missing read -d \0
cleandestinations: use NULL separator in find, use SQL placedholmder
This commit is contained in:
Vincent Riquer 2026-02-15 03:31:41 +01:00 committed by ScriptFanix
parent 3e01f47ea8
commit f56bf00916
2 changed files with 6 additions and 5 deletions

View File

@ -87,7 +87,7 @@ do
destination_names[id]=${rest%%::AtOM:SQL:Sep::*} destination_names[id]=${rest%%::AtOM:SQL:Sep::*}
rest=${rest#*::AtOM:SQL:Sep::} rest=${rest#*::AtOM:SQL:Sep::}
files[id]=${rest} files[id]=${rest}
read -u4 line read -u4 -r -d $'\0' line
done done
echo 'BEGIN TRANSACTION;' >&3 echo 'BEGIN TRANSACTION;' >&3

View File

@ -72,18 +72,19 @@ checkwanted() {
for destination in "${!destinationpath[@]}" for destination in "${!destinationpath[@]}"
do do
echo -ne "\rScanning destination $destination... \033[K" echo -ne "\rScanning destination $destination... \033[K"
while read -r filename while read -r -d $'\0' filename
do do
sqlfile=${filename//$'\n'/::AtOM:NewLine:SQL:Inline::}
if ! Select destination_files id \ if ! Select destination_files id \
>/dev/null \ >/dev/null \
<<<"filename = ${filename#${destinationpath["$destination"]}/}" <<<"filename = ${sqlfile#${destinationpath["$destination"]}/}"
then then
echo -e $'\r'"$filename\033[K" echo -e $'\r'"$filename\033[K"
(( remove )) && rm -f "$filename" (( remove )) && rm "$filename"
echo -n "Scanning destination $destination... " echo -n "Scanning destination $destination... "
fi fi
progressSpin progressSpin
done < <(find "${destinationpath["$destination"]}" -type f) done < <(find "${destinationpath["$destination"]}" -type f -print0)
done done
echo -en "\r\033[K" echo -en "\r\033[K"