Sorry srs, I´m out from home in weekend.
Tkx 4 ur all answ.

This is the idea, I need read from all disks and/or partitions (not network) files office (.doc.xls.ppt.mdb) notes (.id.nsf) but with exeptions (readme.doc, db4lib.nsf, fileit.id, etc)

(This is for backup pruposes in my lan)

This is the script:

Code:

$objFSO = CreateObject("Scripting.FileSystemObject")
$Drives = $objFSO.Drives
For Each $Drive In $Drives
If $Drive.Drivetype = 2
$Origen=$Drive+"\temp" ; for test only, in the last version delete \temp
$ListaCompleta=DirPlus($Origen,$FileExt,1)
$Archivos=UnirArreglos($Archivos,$ListaCompleta)
EndIf
Next

$Exclusiones="DBLIB4.nsf","favorite.nsf","helplt4.nsf","iccon.nsf","log.nsf","lsxlc.nsf","perweb.nsf","readme.nsf,readme.doc"

For Each $Ex In $Exclusiones
$Archivos=FilterArray($archivos,$Ex)
Next

Function UnirArreglos($Array1, $Array2)
Dim $n,$i
$n = Ubound($Array1) + 1
ReDim PRESERVE $Array1[$n+Ubound($Array2)]
For $i = 0 to Ubound($Array2)
$Array1[$n+$i] = $Array2[$i]
Next
$UnirArreglos = $Array1
EndFunction

Function DirPlus($Dir,$mask,optional $subfolders, optional $datatype)
Dim $file, $subflag, $i, $ii,$pattern
If VarType($_temparray) = 0
Global $_temparray[30], $_i
$_i = 0
Else
$subflag = 1
EndIf
If $Dir = 0 Exit(1) EndIf
If SubStr($Dir,Len($Dir),1) = "\"
$Dir = SubStr($Dir,1,Len($Dir)-1)
EndIf
If $mask = 0
$mask = "*.*"
EndIf
$mask = Split($mask,";")
If Exist($Dir) = 0 Exit(2) EndIf
$file = Dir($Dir + "\*.*")
While @error = 0 AND $file
Select
Case $file = "." OR $file = ".."
;bit bucket!
Case GetFileAttr($Dir + "\" + $file) & 16
$_temparray[$_i] = $Dir + "\" + $file
$_i = $_i + 1
If $subfolders = 1
dirplus($Dir + "\" + $file,"*.*",$subfolders)
If @error <> 0 Exit(1) EndIf
EndIf
Case 1
$_temparray[$_i] = $Dir + "\" + $file
$_i = $_i + 1
EndSelect
If Ubound($_temparray) = $_i
ReDim preserve $_temparray[$_i + 30]
EndIf
$file = Dir("")
Loop

If $subflag = 1
;
Else
ReDim preserve $_temparray[$_i-1]
$dirplus = $_temparray
Select
Case $mask[0] = "*.*"
;return all files!
Case 1
Dim $temparray[Ubound($dirplus)]
$ii = 0
For Each $pattern In $mask
$i = 0
For Each $file In $dirplus
If InStr($file,$pattern)
$temparray[$ii] = $dirplus[$i]
$ii = $ii + 1
EndIf
$i = $i + 1
Next
Next
If $ii > 0
ReDim preserve $temparray[$ii-1]
$dirplus = $temparray
Else
$dirplus = 0
EndIf
EndSelect
Select
Case $datatype = 0
;return filename!
Case $datatype = 1
;return File object handle
$i = 0
$fso = CreateObject("scripting.filesystemobject")
If @error <> 0 AND VarType($fso) <> 9 Exit(@errro) EndIf
For Each $file In $dirplus
If GetFileAttr($file) & 16
$file = $fso.getfolder($file)
Else
$file = $fso.getfile($file)
EndIf
$dirplus[$i] = $file
$i = $i + 1
Next
EndSelect
$_i = 0
$_temparray = 0
Exit(0)
EndIf
EndFunction

Function FilterArray($array,$find, optional $inclusive)
Dim $lf, $t, $l, $sp
$lf=Chr(10) $sp=Chr(32)
If NOT VarType($Array) & 8192 Exit(1) EndIf
For Each $l In $array
If (InStr($l,$find) AND $inclusive AND Trim($l)> $sp)
OR (NOT InStr($l,$find) AND NOT $inclusive AND Trim($l)> $sp)
$t=$t+$lf+$l
EndIf
Next
$FilterArray=Split(SubStr($t,2),$lf)
EndFunction



All UDF from kixhelp.com

This array returned ($archivos) I use to backup all them in a $target directory... (the user may add or delete another files but the full script is not ready...)


Edited by @lejo @rias (2004-09-13 04:03 PM)
_________________________
Look always 4 the best...