Using the modification date of a folder as a variable in a script.

Hello generous helpers,

I need to use the modification date of a folder as a variable in a script. I realized that normally when an application saves a file to a folder the folder’s modification date is updated.
With SIMPLY ACCOUNTING the modification of the data files doesn’t seem to update the modification date of the folder in witch there are located.
What could be the reason for this behavior ?? What am I missing ?? Thanks in advance.

:rolleyes: :rolleyes: :rolleyes:

A folder is simply a catalogue of the items “in” it. When you add items or delete them, the catalogue is modified and so the folder’s modification date changes. If you simply do something internally to an item listed in the catalogue, the catalogue itself doesn’t change and therefore neither does its modification date. (An odd exception to this before Mac OS X was that you could change the name of an item in a folder without changing either the item’s modification date or that of the folder. In Jaguar, changing an item’s name still doesn’t affect the item’s own modification date, but does change that of the folder.)

I don’t know if this is any use to you, but the Finder’s ‘sort’ command was still working before Mac OS X. You could get the most recent modification date in a folder like this:

tell application "Finder"
  set latestModDate to modification date of item 1 of (sort myFolder's items by modification date)
end tell

Thanks for the code, it will help …

But still, if I modify a file from within an application and save this modified file, the file and the folder’s modification date are modified. What could explain that this does not happen for files used and modified with the SIMPLY ACCOUNTING application ??