diff --git a/run_full_cleanup.sh b/run_full_cleanup.sh index 20a3c63..c6accfb 100755 --- a/run_full_cleanup.sh +++ b/run_full_cleanup.sh @@ -67,8 +67,10 @@ fi EXCLUDE_FILE="" if [ "$IS_DIR" = true ] && [ "$SKIP_MOST_RECENT" = true ]; then # Find the most recent file by filename date (format: YYYY_MM_DD.md or YYYY-MM-DD.md) + # We need to keep the original filename for the grep filter EXCLUDE_FILE=$(find "$TARGET" -maxdepth 1 -name '*.md' -type f | \ - sed 's/.*\///' | sed 's/_/-/g' | sort -r | head -1) + sed 's|.*/||' | sed 's/_/-/g' | sort -r | head -1 | \ + sed 's/-/_/g') if [ -n "$EXCLUDE_FILE" ]; then echo "Excluding most recent file: $EXCLUDE_FILE" fi