I am in the middle of migrating all my bash scripts to Ruby. I am finding Ruby to be awesome however am stuck with a small problem. I am trying to move this script (basically find all logs older than x hours and process them). The Bash script looks something like this
find /var/log/myservice.log.* -mmin -120 -exec cp {} /home/myhomedir/mylogs/ \;
Of course I can loop through all the files, manually apply File.mtime on them and then identify the ones. However I want to understand if there is a much cleaner, one-liner to do this efficiently.
One liner:
Though I would prefer it spelled out a bit more: