Re : Finder: Delete files
Re : Finder: Delete files
- Subject: Re : Finder: Delete files
- From: "olivier" <email@hidden>
- Date: Mon, 25 Jun 2001 17:28:10 +0200
>
The problem is that date arithmetic does not return a date, but returns
>
the number of seconds between dates.
>
>
Paul's suggestion is elegant.
>
>
--Michelle
>
>
----------------------------------------------------------------------
>
| Michelle Steiner | We're not human beings having a spiritual |
>
| | experience. We're spiritual beings |
>
| email@hidden | having a human experience. |
>
----------------------------------------------------------------------
Hi Paul, Michelle, Hugh,
I've try this.. no result ! Why ?
set midnight to date (date string of (current date))
tell application "Finder"
delete (every file of (choose folder) whose (modification date) < midnight)
-- empty trash
end tell
I write this script, and it's work fine:
set midnight to date (date string of (current date))
tell application "Finder"
set FolderToClean to (choose folder)
set i to count of files of FolderToClean
repeat while i > 0
if (modification date of file i of FolderToClean) < midnight then delete
file i of FolderToClean
set i to i - 1
end repeat
end tell
any other suggestion ?
TIA
Oli.