Long time reader, first time poster.
I'm trying to rsync the latest few log files from a remote server to my laptop. I've gotten close with this:
ssh -qx [email protected] "cd /path/to/logs && find . -mtime -1 -print0" | rsync --from0 --files-from=- -avHS "[email protected]:/path/to/logs/" .
But that syncs all the files from the past day, which is too many. Ideally I'd like to just download the last half dozen or so files. I know this will list the latest 6 files:
ls -t|head -6
But I'm not sure how to use these two bits of info together (if it's even possible) to solve my problem. Thanks in advance!
ssh -qx [email protected] " ls -t /path/to/logs | head -6 " | rsync....?ssh -qx [email protected] "ls -t /path/to/logs | head -6" | rsync --files-from=- -avHS [email protected]:/path/to/logs/ .