Change Detection

Find files modified in last N minutes — -mmin
# Files modified in the last 60 minutes
find ~/atelier/_bibliotheca/domus-captures/docs -name "*.adoc" -type f -mmin -60 -print

# Files modified in the last 5 minutes (active editing)
find ~/atelier/_bibliotheca/domus-captures -name "*.adoc" -type f -mmin -5 \
  -printf '%T+ %p\n' | sort -r
Find files modified since last check — touch reference file + -newer
# Create a reference timestamp (run once)
touch /tmp/find-checkpoint

# ... time passes, work happens ...

# Find everything newer than the checkpoint
find ~/atelier/_bibliotheca/domus-captures/docs -name "*.adoc" -type f \
  -newer /tmp/find-checkpoint -printf '%T+ %p\n' | sort -r

# Update checkpoint for next run
touch /tmp/find-checkpoint
Watch for new files in a directory — find in loop with sleep
cat <<'SCRIPT' > /tmp/watch-new-files.sh
#!/usr/bin/env bash
# Monitor a directory for new .adoc files — Ctrl-C to stop
WATCH_DIR="$HOME/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages"
touch /tmp/watch-reference

echo "Watching $WATCH_DIR for new .adoc files..."
while true; do
  NEW_FILES=$(find "$WATCH_DIR" -name "*.adoc" -type f -newer /tmp/watch-reference -print)
  if [[ -n "$NEW_FILES" ]]; then
    echo "--- $(date +%T) --- New files detected:"
    echo "$NEW_FILES"
    touch /tmp/watch-reference
  fi
  sleep 10
done
SCRIPT

echo "Script written to /tmp/watch-new-files.sh — run with: bash /tmp/watch-new-files.sh"
Find recently accessed files — -atime
# Files accessed in the last day (requires atime not disabled via noatime)
find ~/atelier/_bibliotheca/domus-captures/docs -name "*.adoc" -type f -atime -1 \
  -printf '%A+ %p\n' 2>/dev/null | sort -r | head -20
Compare directory snapshots — before/after diff
# Take a "before" snapshot
find ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages -type f -name "*.adoc" | \
  sort > /tmp/snapshot-before.txt

# ... make changes ...

# Take an "after" snapshot and diff
find ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages -type f -name "*.adoc" | \
  sort > /tmp/snapshot-after.txt

diff /tmp/snapshot-before.txt /tmp/snapshot-after.txt || true
# Lines starting with < are deleted, > are added
Detect permission changes — compare to known-good baseline
# Generate baseline: path + permissions
find ~/atelier/_bibliotheca/domus-captures -maxdepth 3 -type f \
  -printf '%m %p\n' | sort -k2 > /tmp/perms-baseline.txt

# Later — compare current state
find ~/atelier/_bibliotheca/domus-captures -maxdepth 3 -type f \
  -printf '%m %p\n' | sort -k2 > /tmp/perms-current.txt

diff /tmp/perms-baseline.txt /tmp/perms-current.txt || echo "No permission changes"
Monitor disk usage growth — find -size + du
# Files larger than 100K in docs
find ~/atelier/_bibliotheca/domus-captures/docs -type f -size +100k \
  -printf '%s %p\n' | sort -rn | head -10

# Total size of .adoc files
find ~/atelier/_bibliotheca/domus-captures/docs -name "*.adoc" -type f -print0 | \
  du -ch --files0-from=- | tail -1
Find files changed since last git commit — -newer .git/index
# .git/index is updated on every commit — files newer than it are uncommitted changes
find ~/atelier/_bibliotheca/domus-captures/docs -name "*.adoc" -type f \
  -newer ~/atelier/_bibliotheca/domus-captures/.git/index \
  -printf '%T+ %p\n' | sort -r