• 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: File name list order
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File name list order


  • Subject: Re: File name list order
  • From: Doug McNutt <email@hidden>
  • Date: Fri, 10 Dec 2004 19:45:03 -0700

At 11:00 -0600 12/10/04, Michael Conner wrote:
> I have a series of files
>named txt001.tif, txt002.tif etc. that must be combined in order.

If you use a do shell script to exercise the ls tool the return will be sorted in extended ASCII order meaning that each 8 bit byte will be sorted as an unsigned character without regard to it's possible association with other digits to form a number.

set mylist to do shell script `ls *.tif'

I have been experimenting with globbing in the tcsh and it's possible to use filename replacements in something like an echo command that will sort, like the Finder does, treating multidigit numbers the way a non-computer geek might expect.

set mylist to do shell script 'echo *[^0-9]{0-9].tif *[^0-9]{0-9]{0-9].tif`

actually looks at file names in the current working directory and the sort is different from what is returned by ls.

With your leading zeros, if they are all present, you should do OK with a ls command. But get thee into Terminal to check out the commands. I haven't tested them as AppleScripts or as they would run in the default bash, or is it sh, shell for AppleScript..

--

Applescript syntax is like English spelling:
Roughly, but not thoroughly, thought through.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >File name list order (From: Michael Conner <email@hidden>)

  • Prev by Date: Volumes
  • Next by Date: Getting content of an HTML message in Mail
  • Previous by thread: Re: File name list order
  • Next by thread: Activate a Window in Safari
  • Index(es):
    • Date
    • Thread