By far the easiest way is to use zsh. To move the first 3000 files in the current directory into /other/directory
:
mv *([1,3000]) /other/directory
If you've created a few subdirectories that you want to exclude from that command:
setopt extended_glob
mv *([1,3000])~(exclude-me|exclude-me-too) /other/directory
To move files older than 3 months (the first m
is for “modification time”, and the second m
means months; fractional parts are ignored, so +2
means ≥3):
mv *(mm+2) /other/directory
If you'd rather use complicated commands than start a different shell, these are still reasonable one-liners with GNU find:
find -mindepth 1 -maxdepth 1 -print0 | head -n 3000 | xargs -0 -i mv {} /other/directory
find -mindepth 1 -maxdepth 1 -mtime +91 -print0 | xargs -0 -i mv {} /other/directory