Setting Folder Date

I am looking for a script that will set the folder date to the most recent modification date of the files in that folder. Sometimes our job server needs to be restarted and the modification dates of the folders take on the current date and time. It gets very confusing when you want to archive the oldest files on the server. Thanks in advance.

Hi,

give this a try:

set afolder to choose folder
tell application "Finder"
	set SortedFiles to sort (files of folder afolder) by modification date
	set modDate to modification date of (info for (item 1 of SortedFiles as alias))
	set modification date of afolder to modDate
end tell

Thanks,
Nik

Hello.

An alternative is to use the SetFile utility that installs with the Developer Tools.

It has options for both setting creation date, and modification date.

Hi,

Maybe you could keep a log of the latest mod dates in the comments. The dates would need to be alphanumeric (i.e. year, month, day, time).