This commit is contained in:
lyq 2026-05-07 13:43:47 +08:00
parent 3d6cfc2b49
commit 1785d45a8c

16
clean_old_logs.sh Executable file
View File

@ -0,0 +1,16 @@
#!/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."