13 lines
297 B

  1. #!/usr/bin/env sh
  2. if [ $# != 3 ]; then
  3. echo "usage: $0 <cache-fs> <backing-pool> <days-old>"
  4. exit 1
  5. fi
  6. CACHE="${1}"
  7. BACKING="${2}"
  8. N=${3}
  9. find "${CACHE}" -type f -atime +${N} -printf '%P\n' | \
  10. rsync --files-from=- -axqHAXWES --preallocate --remove-source-files "${CACHE}/" "${BACKING}/"