#!/bin/bash # Run nightly on the HOME box. Pulls originals older than 15 days off the server, # moves originals AND their .src raw files; nothing is left behind. # Setup once: rclone config -> new remote "vanguard", type sftp, host media.example.com, user debian, key file. set -euo pipefail REMOTE=vanguard ARCHIVE=/mnt/archive # local HDD MIN_AGE=15d LOG=/var/log/vanguard-archive.log for sub in streams clips; do rclone move "$REMOTE:/srv/media/$sub" "$ARCHIVE/$sub" \ --min-age "$MIN_AGE" \ --exclude '*.part' --exclude '*.normalize-failed.log' \ --transfers 4 --checkers 8 \ --delete-empty-src-dirs=false \ --log-file "$LOG" --log-level INFO done echo "$(date '+%F %T') archive pull done" >> "$LOG"