• 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: Selecting a file by type and creation date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selecting a file by type and creation date


  • Subject: Re: Selecting a file by type and creation date
  • From: Luther Fuller <email@hidden>
  • Date: Fri, 22 Apr 2011 14:04:26 -0500

On Apr 22, 2011, at 1:11 PM, Paul Murphy wrote:

I have a folder which contains a series of sub-folders, inside each sub-folder is a series of files of different file types.  I'd like to get the POSIX path of most recently created JPEG in the most recently created subfolder.

To get what you need, do something like this ...

property testFolder : alias "OS_X:Users:lutherfuller:Library:Caches:com.apple.Safari"
tell application "Finder"
(sort folders of testFolder by creation date)
set mostRecentFolder to (first item of the result as alias)
--
(sort (files of mostRecentFolder whose name extension is "jpeg") by creation date)
set mostRecentFile to (first item of the result as alias)
--
set posixPath to (POSIX path of mostRecentFile)
end tell

The 
(sort (files of ...
 line is way slow. But, someone will know a 'do shell script ...' solution.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Selecting a file by type and creation date (From: Paul Murphy <email@hidden>)

  • Prev by Date: Selecting a file by type and creation date
  • Next by Date: Re: Selecting a file by type and creation date
  • Previous by thread: Selecting a file by type and creation date
  • Next by thread: Re: Selecting a file by type and creation date
  • Index(es):
    • Date
    • Thread