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:
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, '' )