@@ -184,7 +184,7 @@ To run the backup automatically, edit the root crontab.
184184
185185```ini
186186# =================================================================
187- # Configuration for rsync Backup Script v0.27
187+ # Configuration for rsync Backup Script v0.28
188188# =================================================================
189189# !! IMPORTANT !! Set file permissions to 600 (chmod 600 backup.conf)
190190
@@ -301,7 +301,7 @@ END_EXCLUDES
301301
302302` ` ` bash
303303#! /bin/bash
304- # ===================== v0.27 - 2025.08.12 ========================
304+ # ===================== v0.28 - 2025.08.12 ========================
305305#
306306# =================================================================
307307# SCRIPT INITIALIZATION & SETUP
@@ -394,6 +394,10 @@ if [[ "${RECYCLE_BIN_ENABLED:-false}" == "true" ]]; then
394394 echo " ❌ FATAL: RECYCLE_BIN_DIR must be a relative path, not absolute: '${RECYCLE_BIN_DIR} '" >&2
395395 exit 1
396396 fi
397+ if [[ " $RECYCLE_BIN_DIR " == * " ../" * ]]; then
398+ echo " ❌ FATAL: RECYCLE_BIN_DIR cannot contain '../'" >&2
399+ exit 1
400+ fi
397401fi
398402
399403# =================================================================
@@ -744,7 +748,8 @@ run_recycle_bin_cleanup() {
744748 local threshold_timestamp
745749 threshold_timestamp=$( date -d " $retention_days days ago" +%s)
746750 while IFS= read -r folder; do
747- if [[ " $folder " =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] && folder_timestamp=$( date -d " $folder " +%s 2> /dev/null) && [[ -n " $folder_timestamp " ]]; then
751+ local folder_date=${folder%% _* }
752+ if folder_timestamp=$( date -d " $folder_date " +%s 2> /dev/null) && [[ -n " $folder_timestamp " ]]; then
748753 if (( folder_timestamp < threshold_timestamp )) ; then
749754 folders_to_delete+=" ${folder} " $' \n '
750755 fi
@@ -792,7 +797,7 @@ if [[ "${1:-}" ]]; then
792797 echo -e " \n--- Checking dry run for: $dir ---"
793798 rsync_dry_opts=( " ${RSYNC_BASE_OPTS[@]} " --dry-run --itemize-changes --out-format=" %i %n%L" --info=stats2,name,flist2 )
794799 if [[ " ${RECYCLE_BIN_ENABLED:- false} " == " true" ]]; then
795- backup_dir=" ${BOX_DIR%/ } /${RECYCLE_BIN_DIR%/ } /$( date +%F ) /"
800+ backup_dir=" ${BOX_DIR%/ } /${RECYCLE_BIN_DIR%/ } /$( date +%F_%H%M%S ) /"
796801 rsync_dry_opts+=(--backup --backup-dir=" $backup_dir " )
797802 fi
798803 DRY_RUN_LOG_TMP=$( mktemp)
@@ -871,7 +876,7 @@ for dir in "${DIRS_ARRAY[@]}"; do
871876 RSYNC_LOG_TMP=$( mktemp)
872877 RSYNC_EXIT_CODE=0; RSYNC_OPTS=(" ${RSYNC_BASE_OPTS[@]} " )
873878 if [[ " ${RECYCLE_BIN_ENABLED:- false} " == " true" ]]; then
874- backup_dir=" ${BOX_DIR%/ } /${RECYCLE_BIN_DIR%/ } /$( date +%F ) /"
879+ backup_dir=" ${BOX_DIR%/ } /${RECYCLE_BIN_DIR%/ } /$( date +%F_%H%M%S ) /"
875880 RSYNC_OPTS+=(--backup --backup-dir=" $backup_dir " )
876881 fi
877882 if [[ " $VERBOSE_MODE " == " true" ]]; then
0 commit comments