• 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: (resend)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (resend)


  • Subject: Re: (resend)
  • From: Alex Zavatone <email@hidden>
  • Date: Fri, 26 Mar 2010 22:06:31 -0500


On Mar 26, 2010, at 9:22 PM, Mark J. Reed wrote:

"ls -1d" & posixPath & "/*/"

Actually almost.  That ends up getting too much information and some apps as well:

The / before the * ends up causing problems, but if you remove it, it appears to work fine.  But the output is still not sorted properly.  Adding t to the parameters fixes that though.

In the terminal, it would look like this:

ls -1dt */

But trying that in Applescript, it doesn't work as expected, 

set myShellString to "ls -1dt " & (quoted form of POSIX path of myFolder) & "*/"
set myShellResults to do shell script myShellString

This gives this output:

/Optimized PNG/Button bar in layers/
/Optimized PNG/prog info no thumbs/
...

While what is desired is:

Button bar in layers/
prog info no thumbs/
...

The desired output is just a line by line listing of the source folder contents that are folders, sorted by most recent first.  In this case, these are the two strings that end up working in my situation:

set myShellString to "ls -tl " & (quoted form of POSIX path of myFolder) & " | grep '^d'"
set myShellString to "ls -tF " & (quoted form of POSIX path of myFolder) & " | egrep /$"

Using the 'Optimized PNG', directory each shell command expands to:

"ls -tl '/Optimized PNG/' | grep '^d'"
"ls -tF '/Optimized PNG/' | egrep /$"


Always looking for better way to get this stuff done and with this approach, the index is generated instantly, instead of locking up the Finder for over 15 seconds.  Thanks all for spending the time to offer your help.

- Alex
 _______________________________________________
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

  • Follow-Ups:
    • Re: (resend)
      • From: Skeeve <email@hidden>
References: 
 >Re: (resend) (From: Shane Stanley <email@hidden>)
 >Re: (resend) (From: Alex Zavatone <email@hidden>)
 >Re: (resend) (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: (resend)
  • Next by Date: Re: (resend) - $ dir=/Some/Path/To/Server ; y=`date +%Y`; ls -lR $dir | sed -e "s/[0-9]*:[0-9]*/ `echo ${y}`/g"
  • Previous by thread: Re: (resend)
  • Next by thread: Re: (resend)
  • Index(es):
    • Date
    • Thread