• 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: Christopher Nebel <email@hidden>
  • Date: Mon, 15 Mar 2004 17:04:48 -0800

On Mar 15, 2004, at 4:10 PM, steve harley wrote:

on 14 Mar 2004, at 2:04 PM, Christopher Nebel wrote:
set k to paragraph 1 of (do shell script "ls -Ft " & quoted form of d & " | grep -v '/$')

-F adds "/" to directories, but also adds characters to names of executables, symlinks, etc.. -p is cleaner.. and why not just let the shell finish it off:

set k to do shell script "ls -pt " & quoted form of d & " | grep -v /$ | head -1"

Both good points -- I run with -F all the time, so that's the first thing that came to mind. Piping through head(1) had occurred to me, but I suppressed the idea because I don't like the way "do shell script" mangles line endings for you.


--Chris Nebel
AppleScript Engineering
_______________________________________________
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.


  • Follow-Ups:
    • Re: finding newest file in a folder
      • From: Andrew Oliver <email@hidden>
References: 
 >finding newest file in a folder (From: John Cochrane <email@hidden>)
 >Re: finding newest file in a folder (From: Deivy Petrescu <email@hidden>)
 >Re: finding newest file in a folder (From: Christopher Nebel <email@hidden>)
 >Re: finding newest file in a folder (From: steve harley <email@hidden>)

  • Prev by Date: java cgi
  • Next by Date: Re: finding newest file in a folder
  • Previous by thread: Re: finding newest file in a folder
  • Next by thread: Re: finding newest file in a folder
  • Index(es):
    • Date
    • Thread