Re: finding newest file in a folder
Re: finding newest file in a folder
- Subject: Re: finding newest file in a folder
- From: Graff <email@hidden>
- Date: Sun, 14 Mar 2004 13:53:15 -0500
On Mar 14, 2004, at 3:43 AM, Walter Ian Kaye wrote:
At 03:17a -0500 03/14/2004, Graff didst inscribe upon an electronic
papyrus:
You can do something like this:
------------
tell application "Finder"
set theFolder to choose folder
set theItems to every item of theFolder
set latestItem to item 1 of theItems
set latestDate to creation date of latestItem
repeat with aItem in (rest of theItems)
set aDate to creation date of aItem
if aDate is greater than latestDate then
set latestItem to aItem
end if
end repeat
display dialog (name of latestItem) as text
end tell
------------
Umm... don't you have to update latestDate?
tell application "Finder"
set theFolder to choose folder
set theItems to every item of theFolder
set latestItem to item 1 of theItems
set latestDate to creation date of latestItem
repeat with aItem in (rest of theItems)
set aDate to creation date of aItem
if aDate is greater than latestDate then
set latestItem to aItem
set latestDate to aDate
end if
end repeat
display dialog (name of latestItem) as text
end tell
Whups, you're right. Somehow I either deleted that part accidently or
forgot to add it. Good to know that people are paying attention here!
-Ken
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.