Problems with modification/creation dates

I have a simple script to get the modification date of the list of files:


on getTheDate(fileRef)
	set theFile to (selDir & fileRef) as Unicode text
	--get the date info for that file
	return (modification date of (info for theFile) as Unicode text)
end getTheDate

As far as I can tell this should work just fine. It does return a date. That date however is NOT the modification date of the file name that I sent it. Another anomaly is that all dates for all files in a folder return the same regardless of their actual dates.

I can’t seem to get an idea what is happening.

Dee

Well I found the answer to my own question.

It seems that my use of the file used wasn’t correct. It did not produce an error, per say, but the results were incorrect.

I coerced the file to an alias and the dates are now correct:



on getTheDate(fileRef)
   set theFile to (POSIX file (selDir & fileRef)) as alias
   --get the date info for that file
   return (modification date of (info for theFile) as Unicode text)
end getTheDate 


Dee

You do know that the “info for” command is deprecated which means apple will get rid of it at some point? If you look at the standard additions dictionary and find that command, it tells you to use system events to get all properties and stop using info for.