Fix future dates

#!/usr/bin/env bash
set -euo pipefail

BASE="/srv/foo/bar"

find "$BASE" -type f -newermt "now" -print0 |
while IFS= read -r -d '' file; do
    ctime=$(stat -c '%z' "$file")   # ctime in touch-compatible format
    echo "Fixing: $file"
    echo "  using ctime: $ctime"
    touch -d "$ctime" "$file"
    #echo "Done. Stopping after this file."
    #break
done
  • find . -type f -newermt "now"
  • stat /srv/foo/example.txt
  • find "/srv/nextcloud/admin/files/3 Privat" -type f -newermt "now" -exec stat {} \;