Here is the recursive version with the original parameters (just a new optional parameter "verbose")

Code:

$=SetOption( "Explicit", "ON" )
$=SetOption( "NoVarsInStrings", "ON" )

dim $arrPath, $Path, $FileExt, $FullList, $name

$arrPath = "c:\", "d:\"

$FileExt=".doc;.xls;.ppt;.zip;.nsf"

For Each $Path In $arrPath
if $path
"-------------------------------------------------------" ?
" "+$Path ?
"-------------------------------------------------------" ?
$FullList = DirPlus($Path, $FileExt, 1, 0, 1)

for each $name in $FullList
$name ?
next
endif
Next


Function DirPlus($Dir, $mask, optional $subfolders, optional $datatype, optional $verbose)
Dim $SubDirIndex, $SubDirSize, $SubDirSizeInc
$SubDirSize = 0
$SubDirSizeInc = 16
$SubDirIndex = -1
Dim $arrSubdir[$SubDirSize]

Dim $FileArrayIndex, $FileArraySize, $FileArraySizeInc
$FileArraySize = 0
$FileArraySizeInc = 16
$FileArrayIndex = -1
Dim $arrFile[$FileArraySize]
Dim $fso, $arrMask, $file, $filename, $filedata, $ext

If not $Dir Exit 1 EndIf
If not Exist($Dir) Exit 2 EndIf

If Right($Dir,1) <> "\"
$Dir = $Dir + '\'
EndIf

if $verbose $Dir+chr(13) endif

if $datatype=1
$fso = CreateObject("scripting.filesystemobject")
endif

If $mask = 0 $mask = "*.*" EndIf
$arrMask = Split($mask,";")
$file = Dir($Dir + "*.*")
While $file and (not @error)
if ($file <> ".") and ($file <> "..")
$filename = $dir + $file

$filedata = 0
if GetFileAttr($filename) & 16
;-- this is a directory --
if $SubFolders
; add the foldername to an array of subdir
$SubDirIndex = $SubDirIndex + 1
if $SubDirIndex > $SubDirSize
$SubDirSize = $SubDirSize + $SubDirSizeInc
$SubDirSizeInc = $SubDirSizeInc * 2
Redim preserve $arrSubDir[$SubDirSize]
endif
$arrSubDir[$SubDirIndex] = $file

if $datatype=1
$filedata = $fso.getfolder($filename)
endif
endif
else
;-- this is a file --
$ext = instrrev($filename,".")
if $ext
$ext = substr($filename,$ext)
if AScan($arrMask,$ext) <> -1
if $datatype=1
$filedata = $fso.getfile($filename)
else
$filedata = $filename
endif
endif
endif
endif
if $filedata <> 0
;-- add filename in the result array --
$FileArrayIndex = $FileArrayIndex + 1
if $FileArrayIndex > $FileArraySize
$FileArraySize = $FileArraySize + $FileArraySizeInc
$FileArraySizeInc = $FileArraySizeInc * 2
Redim preserve $arrFile[$FileArraySize]
endif
$arrFile[$FileArrayIndex] = $filename
endif
endif
$file = Dir("")
Loop

if $SubFolders
if $SubDirIndex > -1
;-- there are subdirs : scan subdir --
Redim preserve $arrSubDir[$SubDirindex]

dim $SubDir, $arrSubDirFiles
for each $SubDir in $arrSubDir
$arrSubDirFiles = DirPlus( $Dir+$SubDir, $mask, $SubFolders, $DataType, $verbose )

for each $file in $arrSubDirFiles
$FileArrayIndex = $FileArrayIndex + 1
if $FileArrayIndex > $FileArraySize
$FileArraySize = $FileArraySize + $FileArraySizeInc
$FileArraySizeInc = $FileArraySizeInc * 2
Redim preserve $arrFile[$FileArraySize]
endif
$arrFile[$FileArrayIndex] = $file
next
next
endif
endif

if $verbose RPad("",len($Dir)," ")+chr(13) endif

if $FileArrayIndex > -1
Redim preserve $arrFile[$FileArrayIndex]
$DirPlus = $arrFile
Exit 0
else
Exit 3
endif
EndFunction

function RPad( $str, $length, $char )
while len($str)<$length
$str = $str + $char
loop
$RPad = $str
endfunction

function LPad( $str, $length, $char )
while len($str)<$length
$str = $char + $str
loop
$LPad = $str
endfunction



without answer from @lejo @rias, DirPlus returns files and dirs with no use of FSO to scan a disk. FSO is used only if $datatype=1
_________________________
Christophe