Re: finding newest file in a folder
Re: finding newest file in a folder
- Subject: Re: finding newest file in a folder
- From: Walter Ian Kaye <email@hidden>
- Date: Sun, 14 Mar 2004 00:43:33 -0800
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
-boo
_______________________________________________
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.