[futurebasic] Re: [FB]recursive folder searching

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2000 : Group Archive : Group : All Groups

From: Michael Evans <mikonic@...>
Date: Thu, 06 Jan 2000 14:39:39 -0500
on 1/6/00 12:30 PM, Ian Mann at i.mann@... wrote:

> "Gavin J. Dimmock" wrote:
> 
>> Hi All,
>> 
>> Just wondering if anybody out there in FB world has a routine that will list
>> all files in a folder, recursively. ie the routine will also dig down into
>> folders within folders etc.etc. I need to go down about 10 levels maximum.
>> I would appreciate any help whatsoever,
>> 
>> Many regards
>> 
>> Gavin :-)
>> 
>> LOCAL FN TotalBackup (FromFolder$,ToFolder$,FRefNum%,TRefNum%,level)
>> FOR x = 1 TO 3000
>> RefNum% = FRefNum%
>> FromFile$ = FILES$(-x, "",FromFolder$, RefNum%)
>> LONG IF LEN (FromFile$)
>> LONG IF INSTR(1,FromFile$,":")              'is a folder
>> newFromFolder$ = FromFolder$ + FromFile$
>> newFRefNum% = FOLDER(newFromFolder$,0)
>> newToFolder$ = ToFolder$ + FromFile$
>> newTRefNum% = FOLDER(newToFolder$,0)
>> LONG IF newTRefNum% = 0
>> RefNum% = TRefNum%
>> newTRefNum% = FOLDER(newToFolder$,RefNum%)
>> END IF
>> FN TotalBackup
>> (newFromFolder$,newToFolder$,newFRefNum%,newTRefNum%,level+1)
>> XELSE
>> ToFile$ = FromFile$
>> FN BackupFile (FromFile$,ToFile$,FRefNum%,TRefNum%)
>> END IF
>> XELSE
>> x = 3000
>> END IF
>> NEXT
>> END FN
>> 
> 
> Hi Gavin, This backs up files. FN Backupfile is not included...
> 
> FN Total Backup calls itself each time it finds a new folder. You can patch
> this up to give you a list of files.
> 
> Regards
> 
> Ian
> 
> 
> --
> To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>
> 

Nicely done, but I seem to dimly remember some sort of limitation on the
number of times one call call newTRefNum% = FOLDER(newToFolder$,RefNum%)

Perhaps it has to do with a limit on the number of 'open' folders?

I would love to see this done with aliases or FSSpecs, or any other, more
modern, method other than wdRefNum's  ....

Cheers,


----------------------------------------------------------
Michael Evans
3301 Wood Valley Road, NW * Atlanta, GA, 30327-1515
Voice: (404) 846-9386 * Cell: (404) 229-3930
Fax: (404) 240-0878 € E-mail: michael_evans@...
----------------------------------------------------------