What would be the easiest way to go about rsyncing the n newest files in a directory to a remote server?
The easiest way is to run zsh instead of bash.
In the parentheses,
If you want only regular files and not directories, add a
If you want to match files in the directory tree rooted at
Assuming you want to send files from the current working directory:
will do the trick. For example:
This will give an error if there are no files to be found in the current working directory, or if any of the top files contain spaces or other special characters.
The ` characters around
I'll not claim it is without doubt the easiest way but it would be the way I'd first think of.