• 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 entire contents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get entire contents


  • Subject: Re: Get entire contents
  • From: Paul Skinner <email@hidden>
  • Date: Mon, 27 Oct 2003 16:47:29 -0500

Despite Chris Nebel's very informed advice about not parsing Posix paths, I couldn't resist and so I tweaked my handler to handle non-startup volumes. it's consistently working well here. YMMV.

Now featuring...
No recursion. Very quick.
No limits on the number of items returned. (*We all know that's not true, but it's practically true. I've hit no ceiling yet.)
Switches for without-invisibles and filename-contains searches.
ie. EveryFileOfFolder({choose folder, "*script*", true})
Needs some more polishing.

EveryFileOfFolder(alias "titan:Users:paul:Desktop:This folder's name is way too long, and has some punctuation, that's not a Very Good Thing).:")
-->list of 6387 items.

on EveryFileOfFolder(parameters)
set shellFind to "find "
if parameters's class is not list then
set folderReference to parameters as alias
set shellFind to shellFind & quoted form of (POSIX path of folderReference) & " "
else
set folderReference to (item 1 of parameters) as alias
set shellFind to shellFind & quoted form of (POSIX path of folderReference) & " "
try
if first boolean of parameters is false then set shellFind to shellFind & "! -name '\\.*' "
end try
try
set shellFind to shellFind & "-iname '" & the first string of (the rest of parameters) & "' "
end try
end if
set shellFind to shellFind & "-type f | tr -s '//' | tr '/' ':'"

set unicodeReturn to return as Unicode text
try
set filelist to unicodeReturn & (do shell script shellFind)
if filelist is return then return {}
on error
return {}
end try

set prevDelim to text item delimiters
if text 1 thru 10 of filelist is unicodeReturn & ":Volumes:" then
set AppleScript's text item delimiters to unicodeReturn & ":Volumes:"
set filelist to text items of filelist
set AppleScript's text item delimiters to unicodeReturn
set filelist to filelist as Unicode text
end if
if character 2 of filelist is ":" then
set AppleScript's text item delimiters to ":"
set DiskName to text item 1 of (folderReference as Unicode text)
set filelist to paragraphs of filelist
set AppleScript's text item delimiters to unicodeReturn & DiskName
set filelist to filelist as Unicode text
end if

set filelist to rest of paragraphs of filelist
set AppleScript's text item delimiters to prevDelim
return filelist
end EveryFileOfFolder



On Monday, October 27, 2003, at 02:19 PM, John Adam Bloom wrote:

Hello all!

Sorry about length. I probably brought this one on myself soo....

I'm at a client's office and I'm on digest, so any replies to me
directly <email@hidden> would be greatly appreciated. Feel free to
ridicule me otherwise and I'll get with the laughter on the digest when
I can catch up.

Thank you all in advance:

OS 10.2.8

Telling app "Finder" to:

get entire contents of folder "disgustingly long name folder with no
business on a machine" of the desktop

chokes with "Finder out of memory error" between 400 and 415 nested
files at varying depths.

Works same way on G4 Server 10.2.8 w/256 MB RAM as it does on my Al 12"
10.2.8 w/640 MB RAM.

Tried Arthur Knapp's most non-heinous FastDirFiles(f) which burped
while trying to coerce exceedingly long folder path to string

I'm pretty sure I'll have to go the recursive route. Some files are
over 15 levels deep. Any recommendations / snippets are much
appreciated.

A few questions:

Known limitation on data size of variable in AS?

Path name length limitation in AS?

Known limitation on Finder memory?

Total item count issue?

Regards,

John Adam Bloom
_______________________________________________
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 entire contents (From: John Adam Bloom <email@hidden>)

  • Prev by Date: Re: Image Events, panther
  • Next by Date: Re: newbie question: real with fraction to int
  • Previous by thread: Re: Get entire contents
  • Next by thread: File Vault issue?
  • Index(es):
    • Date
    • Thread