How can i move everything but the last n files, n=2?. The files are sorted by date, and their names are yyyymmddhhmmss.txt and yyyymmddhhmmss.txt_aux. The last two files are always being appended, until they got filled, and then new files are created. The creation last 10 minutes aprox. I currently do this, which is a rough approximation; moving everything older than 60 minutes, which leaves about 12 files stored. find /dir/aux1/ -name '*.txt*' -mmin +60 -type f -exec mv {} /dir/aux2/ \;
How to move everything but the last files?
find;timestamps;mv