• 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: Arthur Knapp <email@hidden>
  • Date: Wed, 15 Oct 2003 09:55:53 -0400

Date: Tue, 14 Oct 2003 13:24:31 -0400
Subject: Re: Get every file of the entire contents of a folder. Quickly.
From: Arthur Knapp <email@hidden>

I have to confess that I havn't been able to follow most of this
thread because the "do shell" thingy isn't my cup of tea, but I
have greatly increased the speed of my previous offering:

-- Stolen from Has's everyItemLib: ------------
-- <http://www.barple.pwp.blueyonder.co.uk/>
--
property _maxBlockLength : 3600

on _adjustMaxBlockLength()
set _maxBlockLength to ((_maxBlockLength) div 4) * 3
end _adjustMaxBlockLength

on everyTextItem(theString)
try
set textItemCount to count theString's text items
if textItemCount is less than _maxBlockLength then return theString's text items
set theList to {}
set endLen to textItemCount mod _maxBlockLength
repeat with eachBlock from 1 to (textItemCount - endLen) by _maxBlockLength
set theList to theList & theString's text items eachBlock thru (eachBlock + _maxBlockLength - 1)
end repeat
if endLen is 0 then return theList
theList & theString's text items -endLen thru -1
on error number -2706
_adjustMaxBlockLength()
everyTextItem(theString)
end try
end everyTextItem
-----------------------------------------------

on FastDirFiles2(f)
set tids to AppleScript's text item delimiters
set AppleScript's text item delimiters to "/:"

(* Note: The "as string" coercion/parameter to "entire contents" greatly
* speeds this up over when one ordinarily obtains object references.
*)
tell application "Finder" to set s to every file of entire contents of f as string

(* Need to handle the string-to-list limit:
*)
set a to everyTextItem(s)

set AppleScript's text item delimiters to tids
return a
end FastDirFiles2

FastDirFiles2(choose folder)

{ Arthur J. Knapp;
<mailto:email@hidden>;

What...? Oh...!
}
_______________________________________________
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.

  • Prev by Date: Re: Identifying a remote disk
  • Next by Date: Re: TextField to Command line
  • 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