Re: finding newest file in a folder
Re: finding newest file in a folder
- Subject: Re: finding newest file in a folder
- From: Richard 23 <email@hidden>
- Date: Tue, 16 Mar 2004 19:55:12 -0800
>
Thanks to all for the instructive answers.
>
Before all the solutions flowed in I came up with the clunky workaround
>
of comparing the list of folder contents before and after the scan
>
rather than finding the newest file in the folder. I have inserted it
>
below hoping to learn even more from any suggested improvements.
>
>
tell application "Finder" to set scan_folder_contents to (name of every
>
file of alias scan_folder whose file type is "tiff") as list
>
-- script to perform the scan goes here, then
>
tell application "Finder"
>
set new_contents to (name of every file of alias scan_folder whose
>
file type is "tiff") as list
>
end tell
>
repeat with each_file in new_contents
>
if each_file is not in scan_folder_contents then
>
set new_file_name to each_file
>
end if
>
end repeat
Might I suggest:
tell application "Finder" to get a reference to -->
(files of folder scan_folder whose file type = "tiff")
set scan_folder_contents to result's name as list
-- script to perform the scan goes here, then
tell application "Finder" to get a reference to -->
(files of folder scan_folder whose file type = "tiff" -->
and name is not in scan_folder_contents)
set new_contents to result's name as list
R23
_______________________________________________
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.