summaryrefslogtreecommitdiff
path: root/perms.sh
blob: 30ba7565af8fa4821f1cce0aed0112cb21d67b84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# Safe and resumable chmod script with progress output

TARGET_DIR="/mnt/raid5"
LOGFILE="$HOME/chmod_resume_$(date '+%Y%m%d-%H%M').log"
INTERVAL=500

echo "🔧 Starting permission normalization on $TARGET_DIR"
echo "Logging to $LOGFILE"
echo "Started at $(date)" >> "$LOGFILE"

i=0
find "$TARGET_DIR" -type d -not -perm -005 | while read -r dir; do
  chmod o+X "$dir"
  echo "✔️  $dir" >> "$LOGFILE"
  ((i++))
  if ((i % INTERVAL == 0)); then
    echo "⏳ Processed $i directories so far..."
  fi
done

echo "✅ Completed at $(date)" >> "$LOGFILE"
echo "✅ chmod finished. Total: $i directories."