Re: newest file in a folder
Re: newest file in a folder
- Subject: Re: newest file in a folder
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 18 Dec 2000 00:58:55 -0500
- Organization: [very little]
Hevard wrote:
>
Date: Sun, 17 Dec 2000 23:19:14 +0100
>
To: email@hidden
>
From: =?iso-8859-1?Q?H=E5vard?= <email@hidden>
>
Subject: newest file in a folder
>
>
What is the clean and easy way to get an alias to the newest file of
>
a folder? (the one with the newest modification date.)
>
>
if I
>
tell app "Finder" to get first file of myFolder
>
--> first file by name.
>
How do I get "last file by date"?
If you want to do it without third-party scripting additions, this works:
tell application "Finder"
set fileList to (sort files of myFolder by modification date)
end tell
set newFile to (contents of item 1 of fileList) as alias
Marc [12/18/00 12:53:50 AM]