• 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: Get every file of the entire contents of a folder. Quickly.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get every file of the entire contents of a folder. Quickly.


  • Subject: Re: Get every file of the entire contents of a folder. Quickly.
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 14 Oct 2003 13:35:26 -0700

On Oct 13, 2003, at 1:57 PM, Paul Skinner wrote:

In trying 'entire contents of' and Satimage's 'list files' I am left unsatisfied. I won't even try recursing the directories in AppleScript.

Satimage OSAX 2.5.5 won't go recursive OMM even though that is the default, and 'entire contents of' is SO SLOW! So here's my current solution. I think it runs at 'Ludicrous speed'. Returning 4960 unfiltered files in less than four seconds on my 667 PB G4, although I can't compare it to Satimage due to the later's refusal to perform.

Can you break it?

Trivially. Just point it at a folder on a disk that's not the startup disk. Never, ever, try to do your own POSIX-to-HFS conversion by munging strings if you care about correctness. Either return the POSIX paths (which would cut out about half the script), or use "POSIX file" to do the conversion.

Offer improvements?

You already found the one about using find's -name option instead of grep; Kai's suggestion of "set searchterm to item 1 of p's strings" would be better written as "set searchterm to first string of p" -- that way, it doesn't waste time constructing a list of all of them.

As written, the search term is case-sensitive; to change that, use -iname instead of -name. Also, find(1) will not go through symlinks by default; add -L to do so. This is somewhat a matter of taste -- following symlinks can lead to the same file being listed more than once by different paths. find(1) does not support aliases at all.


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

References: 
 >Get every file of the entire contents of a folder. Quickly. (From: Paul Skinner <email@hidden>)

  • Prev by Date: Re: forwarding in Eudora
  • Next by Date: Re: Get every file of the entire contents of a folder. Quickly.
  • Previous by thread: Re: Get every file of the entire contents of a folder. Quickly.
  • Next by thread: Re: Get every file of the entire contents of a folder. Quickly.
  • Index(es):
    • Date
    • Thread