on 3/16/06 7:56 PM, "Joseph J. Strout" <[EMAIL PROTECTED]> wrote:
> Message: 23
> Subject: Re: List of all files and folders for a given volume
> From: "Joseph J. Strout" <[EMAIL PROTECTED]>
> Date: Thu, 16 Mar 2006 20:56:12 -0700
>
> At 7:28 PM -0800 3/16/06, Jeffrey Ellis wrote:
>
>> I'm trying to get a complete list of all files and folders that exists on a
>> given volume, as many levels down as they may go, and whether they're
>> invisible or not, and, if possible, even if they are contained as part of an
>> application's package contents, i.e. -- everything.
>>
>> Is there a way to do this?
>
> Sure. If you search the archives for "recursion" you'll probably
> find several implementations of this -- it's the classic example of a
> recursive algorithm.
>
> In brief, you make a function that processes a folder, by iterating
> over all the items it contains. For any item that's a folder, the
> function calls itself, passing in that item. (Or you can do it by
> maintaining a to-do list in the form of an array, and when you find a
> folder, you add it to your to-do list, and keep going until the to-do
> list is empty.)
>
> Best,
> - Joe
Looks like I've got quite a bit of this working. I'd now like to compare the
two lists, one for the source volume and one for a target volume, and mark
any discrepancies.
I've tried just a simple if a<>b comparison going one row at a time in each
list, then inserting a row into the Target (b) list with the missing
information from the Source list, to make sure that going forward the lists
will still match. Then I mark the added row.
But it doesn't seem to work. I have manually counted the files in each test
folder and know there is a difference of about 54 files from the source to
the target. Yet I'm marking more than 6000 files as missing.
Here's my current (rather primitive) code...
missingFiles=0//init
for compare = 0 to SourceList.Listcount-1
a=SourceList.Cell(compare,0)
b=TargetList.Cell(compare,0)
p=SourceList.Cell(compare,1)
if a<>b then
TargetList.insertRow compare-1, " ADDED."+a
TargetList.Cell(TargetList.LastIndex,1)=p
missingFiles= missingFiles+1
else
end if
Next
SourceList.PressHeader(0)
TargetList.PressHeader(0)
staticText6.text=cstr(missingFiles)
Thanks :)
All My Best,
Jeffrey
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>