#130553 - 2004-12-03 09:35 PM
Filer Array of Files
|
@lejo @rias
Starting to like KiXtart
Registered: 2003-09-02
Posts: 100
Loc: Medellin, Colombia
|
Hi, I need exclude some files from an array of elements (files & path)
Ex: array $files = e:\dir3\lis.doc c:\temp\file1.xls c:\programfiles\prog1\file1.mdb c:\windows\text.doc d:\program2\dir3\text.jar
I use Code:
$excl="text","file1" For Each $Ex In $Excl $Archivos=FilterArray($archivos,$Ex) Next
but the filter not exclude, only work if I write the full path, exist some way to work without full path? only the filename?
_________________________
Look always 4 the best...
|
|
Top
|
|
|
|
#130554 - 2004-12-03 10:46 PM
Re: Filer Array of Files
|
maciep
Korg Regular
   
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
I'm not sure what problem you are having. when i run the following code
Code:
break on
$Archivos = 'e:\dir3\lis.doc', 'c:\temp\file1.xls', 'c:\programfiles\prog1\file1.mdb', 'c:\windows\text.doc', 'd:\program2\dir3\text.jar'
$excl="text","file1"
? "-------- Before -----------" for each $f in $Archivos ? $f next
For Each $Ex In $Excl $Archivos=FilterArray($Archivos,$Ex) Next
? ? ? "-------- After -----------" for each $f in $Archivos ? $f next
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
I get the following output
Quote:
-------- Before ----------- e:\dir3\lis.doc c:\temp\file1.xls c:\programfiles\prog1\file1.mdb c:\windows\text.doc d:\program2\dir3\text.jar
-------- After ----------- e:\dir3\lis.doc
_________________________
Eric
|
|
Top
|
|
|
|
#130556 - 2004-12-03 11:23 PM
Re: Filer Array of Files
|
@lejo @rias
Starting to like KiXtart
Registered: 2003-09-02
Posts: 100
Loc: Medellin, Colombia
|
Not Bryce, I need the maciep response, but in my script don't work
i will post full code monday.. tks
_________________________
Look always 4 the best...
|
|
Top
|
|
|
|
#130558 - 2004-12-06 11:21 PM
Re: Filer Array of Files
|
@lejo @rias
Starting to like KiXtart
Registered: 2003-09-02
Posts: 100
Loc: Medellin, Colombia
|
Hi, I found the problem but not the solution.
Well, if I use the following code:
$excludes="frunlog","DBLIB4","favorite","helplt4","iccon","log","lsxlc","perweb","readme","leame","java"
the filter function work, but if I use readprofilestring, not return an array, return the full string and the function not work.
$excludes=ReadProfileString("N:\REN\DAT.INI","VR","EXCL")
_________________________
Look always 4 the best...
|
|
Top
|
|
|
|
#130560 - 2004-12-07 12:12 AM
Re: Filer Array of Files
|
@lejo @rias
Starting to like KiXtart
Registered: 2003-09-02
Posts: 100
Loc: Medellin, Colombia
|
Tks Les, work fine.
_________________________
Look always 4 the best...
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1636 anonymous users online.
|
|
|