Re: newest file in a folder
Re: newest file in a folder
- Subject: Re: newest file in a folder
- From: Jason Bourque <email@hidden>
- Date: Sun, 17 Dec 2000 21:18:58 -0500
>
> tell application "Finder"
>
> set newFileAlias to (item 1 of (sort every file of myFolder by
>
> modification date)) as alias
>
> end tell
>
>
>
One line! That's the cleanest so far. To get the "last file by date"
>
change it to:
>
>
set newFileAlias to (item 1 of (the reverse of (sort every folder of
>
x by modification date))) as alias
>
>
jmc
>
--
>
John McAdams
Maybe a little shorter still.
tell application "Finder"
set x to item 1 of (every item of folder aFolder sort by modification
date) as alias
end tell
or
tell application "Finder"
set x to item -1 of (every item of folder aFolder sort by modification
date) as alias
end tell
Jason Bourque