Re: Determine if a filename exists in a LARGE folder
Re: Determine if a filename exists in a LARGE folder
- Subject: Re: Determine if a filename exists in a LARGE folder
- From: Pier Kuipers <email@hidden>
- Date: Wed, 13 Jun 2001 22:00:06 +0100
At 12:41 -0400 13/6/01, Matthew Broms wrote:
>
I have a bit of a unique problem. I have a script that processes a large
>
batch of post cards that go out to customers. Each post card has a space
>
for a signature. This signature is a graphic that either is or is not on
>
file in a folder.
>
>
I was going to get a list of filenames in a designated folder and see if
>
this list contained "xyz" filename (easy - works well). The problem is that
>
this folder is 11 gigabytes in size and currently contains 42,225 items in
>
it. Getting a list this size is rather slow and the list is VERY large
>
given such a large folder (and there is no way I'm able to break this folder
>
down into more manageable sub-folders since this folder is referenced by 3+
>
Indigo printers). Does anyone know how to efficiently (that is, reasonably
>
fast) check for the mere existence of a filename in such a large folder? My
>
experience is that the Mac OS Finder doesn't deal very quickly with folders
>
that have such a large number of files. Doing a straight reference to the
>
file directly is slow too - in a try statement I did a "set test to info for
>
alias fileNamePath" and set it to a default signature on error. This worked
>
properly, but just crawled along. Any suggestions?
>
>
Thanks,
>
>
Matt
How about using the "find document" OSAX by Jean Francois Pautex? It
allows you to search an entire hard drive, starting at root or at any
subfolder, for the existence of a file. I find it very fast, and an
invaluable OSAX. 2B found at
http://www.osaxen.com/?id=find_document.
You could test it with something like
set theFileToLookFor to find document "MyDocument.doc" in disk
"Macintosh HD:Folder1:Folder2:"
if (count theFileToLookFor) > 0 then
display dialog "It exists."
else
display dialog "It doesn't exist."
end if
Worth a try, I would think.
Pier.
--
Pier Kuipers
Visual ID
* the Media Asset Management solution *
2 Whitefriars
Aungier Street
Dublin 2
Tel. +353 1 476 7059
Mobile +353 87 294 3063
Fax +353 1 478 1366
ISDN +353 1 602 0754
http://www.visualid.com