Directory Help

Started by Mike Burgoon, July 11, 2013, 12:24:34 PM

Previous topic - Next topic

Mike Burgoon

hello, I am trying to get a full list of all directories and subdirectories off of a unc share. What is the best way to go about this. I have tried an example using srchInit from the tech support site, but that does not work for some reason. I also tried with fafopen and faffind, but it was PAINFULLY slow on a large set of dirs. worked fine on a small set, but the large set ran forever and I finaly just killed the process.

Basically, I am looking for output to be similar to a "dir s:\*.* /s /b /A:D" except I need unc share instead of s:\

Thanks

srchinit code below that does not work:

; get directories from source location
log ("**********")
log ("Getting Directory List...")
TopSrchDir = "%src%\"
nHandle = srchInit(TopSrchDir,"XXXXXXXX.XXXX","", 0,48) ;srchinit(path, mask, strings, exclude mask, flags )
while 1
   xxx=srchNext(nHandle)
   If xxx=="" then break
   dir_list = ItemInsert(xxx, -1, dir_list, @TAB)
EndWhile
srchFree(nHandle)
log ("Completed")
FilePut("%inst%dirlist.txt", dir_list)







Deana

I recommend using the File and Folder extender it is very fast. Plus it has a flag to ignore files and only look at directories. One other thing that will speed it up is to write out the file name each time instead of building a big string then writing it out. Here is a code sample that should get you started:
Code (winbatch) Select
AddExtender('WWFAF44I.DLL')
outputfile = Dirscript():'dirlist.txt'
;handle = fafOpen('\\?\UNC\Server64\Outbound', '*', 8|16) ; To specify an extended-length path, a maximum path of 32,767 characters, use the "\\?\" prefix. 
handle = fafOpen('\\Server64\Outbound', '*', 8|16)
nCount = 0
BoxOpen('Directories', '')
filehandle = FileOpen( outputfile, 'Write')
While 1
   sFound = fafFind( handle )
   If sFound == '' Then Break
   nCount = nCount + 1
   BoxTitle( nCount )
   BoxText( sFound )
   FileWrite( filehandle, sFound )
EndWhile
fafClose( handle )
FileClose( filehandle )
Run( outputfile, '' )
Deana F.
Technical Support
Wilson WindowWare Inc.

Mike Burgoon

thanks, that did the trick.  I did one before with FAF, but it ran a REALLY long time.  writing the output to the file as it goes seems to work much faster now.

Thanks