Re: Edit the date Modified field
Re: Edit the date Modified field
- Subject: Re: Edit the date Modified field
- From: Michelle Steiner <email@hidden>
- Date: Sat, 20 Oct 2001 14:40:26 -0700
On 10/20/01 2:13 PM, Mark Gibson <email@hidden> wrote:
>
The script above works fine if I highlight the file and run it (no
>
doubt I could save it as an app and drop files on it too).
True.
>
The problem I face is working my way through a server volume with
>
many folder levels and many dates to reset. I'm happy to run the app
>
several times but I need some sort of IF statement that says "If year
>
of date = 1963 then run" and the ability to dig down into the folder
>
structure.
>
>
The current script is fine for a file but if I select more than one
>
it only changes one file.
I used that only as an example; it's not the best way to choose a
file--making a droplet would work better, of course, unless you have only
a few to do. Here's a solution; I have not tested it, though, but it
does compile. I didn't take you literally about 1963, but considering
that the Mac was released in 1984, I wrote it to change the modification
date of any file whose modification date is earlier than 1984.
--Michelle
on open (itemList)
separateFilesFromFolders(itemList)
end open
to separateFilesFromFolders(itemList)
tell application "Finder"
set the fileList to the files of the itemList
set the folderlist to the folders of the itemList
end tell
changeDate(fileList)
separateFilesFromFolders(folderlist)
end separateFilesFromFolders
to changeDate(fileList)
repeat with thisFile in the fileList
tell application "Finder" to set the modDate to the modification date
of thisFile
if the year of the modDate is less than 1984 then
set the year of the modDate to the year of (current date)
tell application "Finder" to set the modification date of thisFile to
the modDate
end if
end repeat
end changeDate
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------