This commit is contained in:
Oleg Sheynin
2026-06-23 19:51:34 +00:00
parent 15799cd4f7
commit f152b7c358
+3 -2
View File
@@ -52,7 +52,7 @@ echo "Looking for log files older than ${DateCriteria} in ${ArchiveDir}"
# 1. First, check if any matching files exist using a quick find check # 1. First, check if any matching files exist using a quick find check
if ! find "${ArchiveDir}" -type f -not -newermt "${Oldest}" -print -quit | grep -q .; then if ! find "${ArchiveDir}/" -type f -not -newermt "${Oldest}" -print -quit | grep -q .; then
echo "No files found older than ${Oldest} in ${ArchiveDir}" echo "No files found older than ${Oldest} in ${ArchiveDir}"
echo "Done ${0} ${*}" echo "Done ${0} ${*}"
exit 0 exit 0
@@ -65,8 +65,9 @@ echo "-----------------"
# 2. Safely pipe find into rsync using relative paths from the ArchiveDir base # 2. Safely pipe find into rsync using relative paths from the ArchiveDir base
# This completely avoids "Argument list too long" errors and handles spaces perfectly # This completely avoids "Argument list too long" errors and handles spaces perfectly
set -x set -x
find "${ArchiveDir}" -type f -not -newermt "${Oldest}" -printf "%P\0" | \ find "${ArchiveDir}/" -type f -not -newermt "${Oldest}" -printf "%P\0" | \
rsync -ahvv \ rsync -ahvv \
-e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" \
--remove-source-files \ --remove-source-files \
--mkpath \ --mkpath \
--from0 \ --from0 \