script aborts if no qcow2-File found

This commit is contained in:
Raphael Dannecker 2023-10-08 19:47:01 +02:00
parent 3768d0e77b
commit d7d0069dd3

View file

@ -67,7 +67,7 @@ sync_all_images() {
delete_old_qcows() {
cd /lmn/vm
for qcow2 in *.qcow2; do
for qcow2 in $(find . -maxdepth 1 -name "*.qcow2" -exec basename {} ';'); do
qcowsize=$(stat -c%s "${qcow2}")
if [[ -f "${qcow2}.size" ]] && [[ "${qcowsize}" != $(<"${qcow2}.size") ]]; then
torrent="${qcow2}.torrent"
@ -77,7 +77,7 @@ delete_old_qcows() {
fi
rm "${qcow2}"
fi
done
done
}
sync_all_torrents() {