sweeper_200/clean_old_logs.sh

16 lines
300 B
Bash
Raw Normal View History

2026-05-07 13:43:47 +08:00
#!/bin/bash
BASE=~/Downloads/sweeper_200/nodes_log
KEEP_DATE=20260501
cd "$BASE" || exit 1
find . -mindepth 2 -maxdepth 2 -type d \
| grep -E '/[0-9]{8}$' \
| awk -F/ -v keep="$KEEP_DATE" '$3 < keep' \
| while read dir; do
echo "Deleting: $dir"
rm -rf "$dir"
done
echo "Cleanup complete."