• 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: 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.


  • Prev by Date: AC power testing
  • Next by Date: Re: AC power testing
  • Previous by thread: Re: finding newest file in a folder
  • Next by thread: scriptable applescript application
  • Index(es):
    • Date
    • Thread