• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: finding newest file in a folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: finding newest file in a folder


  • Subject: Re: finding newest file in a folder
  • From: John Cochrane <email@hidden>
  • Date: Tue, 16 Mar 2004 15:27:48 +1100

On 14/03/2004, at 17:06, I wrote:

> Hello scripters.
>
> I am trying to get a reference to a file that I have just scanned in
> to a folder. My scanning software won't get it for me so I thought I
> would try to identify it by finding the file of the 'scan_folder'
> whose creation date is latest.
> I think a repeat loop is needed but can't seem to get it right.
> I'd appreciate any pointers.

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


John Cochrane
_______________________________________________
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.


  • Prev by Date: Re: finding newest file in a folder
  • Next by Date: Re: applescript to get system version
  • Previous by thread: Re: finding newest file in a folder
  • Next by thread: Re: finding newest file in a folder
  • Index(es):
    • Date
    • Thread