I've encountered a situation where a Mac user needs to update the modified time of a file. If I was doing this, I'd just open up Terminal, cd to the file, and use the touch command. However, the person doing this is not me and I'd like to avoid making their lives more complicated with Linux commands. So, is there a simple way to touch a file from the OS X UI? This user will either be using Snow Leopard or Lion.
Asked
Active
Viewed 8,885 times
7
abeger
- 795
- 2
- 8
- 9
-
3Opening the file, changing something, saving, undoing the change, and saving again isn't an option? – Daniel Beck May 24 '12 at 17:07
-
It's an audio file for one thing, which makes changing it a little dicier. That said, if I can provide them with a solution that doesn't involve opening another program, that'd be optimal. – abeger May 24 '12 at 17:10
3 Answers
10
Open Automator and create a new Application.
From the Library, add a Run Shell Script action that receives input as arguments.
Change the sample script from cat to touch and save, e.g. as Update Time anywhere on your system.
Zip the created application (File » Compress "Update Time" in Finder) and email the .zip file to your user with the instructions to:
- Save the attachment to the Downloads folder
- Double-click the saved file to extract the application
- Drag & drop the audio file onto the application (with the robot icon)
Daniel Beck
- 109,300
- 14
- 287
- 334
-
This worked great for me. A note to anyone else following these instructions: Make sure you change the input type BEFORE you change the cat to touch. – abeger May 25 '12 at 19:36
-
If you want to use this yourself, an even easier method is to select 'service' instead of 'application'. Say that it accepts files/folders from finder as input. Then create the service the same way as Daniel Beck describes. Then save and call it 'Touch'. Then in finder you can just right click on a file and 'Touch' will appear in the menu. – Daniel Howard May 31 '16 at 11:19
0
I need this as well. Is there no way to add a 'touch file' option to finder? So much other crap inserts options to it.
Keith
- 1
-
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 24 '23 at 14:24
-
This does not provide an answer to the question. Once you have sufficient [reputation](https://superuser.com/help/whats-reputation) you will be able to [comment on any post](https://superuser.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/1179970) – Peregrino69 Mar 24 '23 at 14:51
0
If this is part of a recurring task then perhaps you could use this free touch tool:
http://www.macupdate.com/app/mac/32413/touch-files
Or, this AppleScript solution might work:
Jeremy
- 676
- 1
- 5
- 11
-
2Your "AppleScript solution" is for Mac OS 9, obsolete for over a decade. The first link points to an Automator action, which requires understanding of Automator to use. Have you even looked at those before posting? – Daniel Beck May 24 '12 at 17:21
-
Yikes, sorry, I didn't notice it said OS 9 on the AppleScript solution (I found that right before I posted so I threw it in). As for the Automator solution, I just figured that if this was a recurring task it might be worth taking the time to setup for your user(s). However, based on what you're saying, a recurring solution isn't useful here. – Jeremy May 24 '12 at 17:48
-
It'd make sense for the case where you'd set it up for yourself, not like the user asked. I don't think there's a really immediate solution to do this on the GUI, unfortunately. The shell solution I describe would survive Automator action format changes, while being a bit more complicated to set up. – Daniel Beck May 24 '12 at 17:55