diff --git a/clean_old_logs.sh b/clean_old_logs.sh new file mode 100755 index 0000000..2672859 --- /dev/null +++ b/clean_old_logs.sh @@ -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." \ No newline at end of file