• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Comparing file timestamps

spanky

Lifer
I'm trying to compare a file's mtime to the current time. Does anyone know how I can do this? The goal is to be able to have a script that will delete certain files that have a mtime greater than 24 hours. Thanks!
 
How do you want to do this?

I just took 2 mins to try this in Automator.... pretty simple. Go check it out!
 
Last edited:
Hi. I want to be able to do this via command line, because I want to pack it into a shell script. I guess I'm looking for some command line help 🙂
 
You can save Automator workflows as an application (and then run it from the command line?) or use the automator command to run workflows from the command line.

Unfortunately, I think I just ran into a bug where 'in the last x days' does not include today. So you'd have to include that additionally if you want to include today.
 
You can save Automator workflows as an application (and then run it from the command line?) or use the automator command to run workflows from the command line.

Unfortunately, I think I just ran into a bug where 'in the last x days' does not include today. So you'd have to include that additionally if you want to include today.

i was able to get some help over at macrumors, and a fellow there informed me that i could do what i wanted in one fell swoop with the following command:

find . -not -newermt "24 hours ago" -exec rm '{}' \;

thank you speg for your feedback. i've not used automator much, but it does appear to be a powerful tool to fiddle with and learn
 
Back
Top