Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Set files' modification time from Finder System
This hint is about touching files from the Finder to update their mod time, much as you can do in Terminal with the touch command. Here's how:
  1. Select files to be 'touched' in the Finder.
  2. Press Command-Option-I to open the multiple item info inspector window (File » Show Inspector).
  3. Toggle/activate the Open With pop-up menu. You needn't select anything, just click to activate the menu.
The file's modified timestamp will be updated to now time; tested in 10.6.2.

[robg adds: In my testing, I didn't have any luck with the time changing just by merely activating the menu; I had to select the currently-active option for the chosen files. If I selected files with different Open With settings (such that the pop-up menu reads Not Applicable), I couldn't change the modification timestamp at all via this method.]
    •    
  • Currently 1.85 / 5
  You rated: 5 / 5 (27 votes cast)
 
[8,363 views]  

Set files' modification time from Finder | 14 comments | Create New Account
Click here to return to the 'Set files' modification time from Finder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set files' modification time from Finder
Authored by: jfa643 on Dec 11, '09 08:18:20AM

Did not work for me either.



[ Reply to This | # ]
Even if this hint worked...
Authored by: lincd0 on Dec 11, '09 11:35:19AM

... how would it be better than opening a Terminal window, typing 'touch ', dragging the files to be modified into the window, and hitting the Return key?



[ Reply to This | # ]
Even if this hint worked...
Authored by: cran on Dec 13, '09 11:04:18PM

come on. This hint is about doing something with the finder. Not about the Finder being better than the command line. Or vice versa.

Besides this you could ask "why not do this in the terminal" for a lot of hints...

Btw. here's a reason for not doing it on the command line: If you want to do it to a lot of files (so they won't fit into ARG_MAX when being supplied on the command line), and you don't want to fiddle with find/xargs/zargs/..

On the other hand. Thanks for this hint. Now I know that selecting the default application for files changes their mtime. This means that my backups will be much larger after I changed my mp3 player software. How silly is this? :)



[ Reply to This | # ]
Even if this hint worked...
Authored by: mantrid on Dec 14, '09 07:38:44AM
Now I know that selecting the default application for files changes their mtime. This means that my backups will be much larger after I changed my mp3 player software. How silly is this?
The hint boils down to this: modifying a file updates its modification time.

Changing your mp3 software should not make your backups significantly bigger unless you are changing each individual file, which really would be silly. If you were to use the "Change All…" setting to change the default application, only the first file and the launch services prefs file would be updated and need to be backed up.
Edited on Dec 14, '09 07:39:20AM by mantrid


[ Reply to This | # ]
Even if this hint worked...
Authored by: cran on Dec 14, '09 02:37:44PM

Thanks for clarifying. But I still don't understand: how does selecting the default application change my file? I'd understand if it changed the ctime (which it does). I'd understand if it changed the mtime (because it's just the way it is). But why would it change my files contents?



[ Reply to This | # ]
Set files' modification time from Finder
Authored by: rpaege on Dec 11, '09 11:54:46AM

Or just use the Nudge contextual menu item:

http://www.brockerhoff.net/nudge/Nudge11.dmg

Edited on Dec 11, '09 12:01:34PM by rpaege



[ Reply to This | # ]
Set files' modification time from Finder
Authored by: dennis.se on Dec 12, '09 02:43:53AM

I'd say there's a pretty huge difference between just updating the mod-time to the current time and actually setting it (which implies that you can set it to what ever you want.)



[ Reply to This | # ]
Set files' modification time from Finder
Authored by: Hal Itosis on Dec 13, '09 09:20:45AM
@lincd0:
Even if this hint worked... how would it be better than opening a Terminal window, typing 'touch ', dragging the files to be modified into the window, and hitting the Return key?

Because, this hint adds a fat juicy extended attribte: i.e., a usro resource fork to the file...

com.apple.ResourceFork 1338

...thus adding an extra 1K (at least) to the size of every file we tweak. (need to use ls -l@ or xattr -l to see it).

That's why it's "better" than touch in Terminal. ;-)

-HI-

[ Reply to This | # ]

Set files' modification time from Finder
Authored by: mael on Dec 13, '09 01:36:33PM

This is ... umm ... absolutely wrong.

I don't know what you do, but 'touch' does *not* add *anything* to a file. Especially *NOT* extended attributes.
'touch' is a pure unix command. It couldn't care less for extended attributes and has not been extended by apple to cope with those.

Maybe you are running a virus scanner or anything else that does this?

Edited on Dec 13, '09 01:38:20PM by mael



[ Reply to This | # ]
Set files' modification time from Finder
Authored by: bauldrywc on Dec 13, '09 02:09:26PM

Umm… actually, it's right... ;)

Following the procedure using the 'Get-Info' box and 'Open-with' pop-up does add a 'usro' resource which can be shown by an xattr -l command. Of course, you're right about 'touch' not adding a resource fork.



[ Reply to This | # ]
Set files' modification time from Finder
Authored by: mael on Dec 13, '09 02:48:41PM

hmmm. okay. then I think I missed the irony.
As long as we agree on 'touch' being clean, I'm happy. :-)

Edited on Dec 13, '09 02:49:28PM by mael



[ Reply to This | # ]
Set files' modification time from Finder
Authored by: kemeng on Dec 13, '09 02:56:34PM
IT WORKS:) 1) Command+I (Command+Option+I not necessary) 2) Check Modified Date 3) Toggle/activate the Open With pop-up menu and choose default/same (or other) application.

[ Reply to This | # ]
Set files' modification time from Finder
Authored by: bobcole on Dec 14, '09 06:14:59PM
How about an AppleScript:
tell application "System Events"
  set the modification date of (choose file) to (date "Tuesday, December 15, 2009 8:07:06 PM")
end tell

Or you can use other commands, like:
  set the modification date of (choose file) to ((current date) - 1 * days)


[ Reply to This | # ]
Set files' modification time from Finder
Authored by: ccstone on Dec 15, '09 08:19:39AM
tell application "Finder"
	set sel to selection as alias list
	repeat with ndx in sel
		set modification date of ndx to (current date)
	end repeat
end tell
If you need to touch files often then bind a keyboard shortcut to this script in FastScripts or another script runner and go to town. (Note: this works in Leopard and Snow Leopard but needs tweaking to work in Tiger.)

[ Reply to This | # ]