Hello,
could you please give me guidance on the following. In a directory "C:\INPUT" I have multiple other directories which includes also multiple files. If the files have a name equal "domains" or "urls" I would like to write the contents of these files to one output file "LOCALDB". Below I did some coding, but I'm not sure if this is the right way to do this (with all the OPENS,filehandles, CLOSE, readlines and writelenes). Thnaks for help.
Bjoern
Code:
$HandleOutput = FreeFileHandle ()
$RC = Open($HandleOutput, "C:\LOCALDB",1+4) ; Open Output File
CD "C:\INPUT"
For $I4 = 0 to Ubound($WorkArray)
CD $WorkArray[$I4]
$AktivDir=Dir($WorkArray[$I4])
While $AktivDir <> "" And @ERROR = 0
If ($AktivDir = "domains") Or ($AktivDir = "urls")
$Handle = FreeFileHandle ()
$RC = Open($Handle, "C:\INPUT\"+$WorkArray[$I4]+$AktivDir, 2)
While Not (-1)
$Line = ReadLine($Handle)
$RC = WriteLine($HandleOutput, $Line+@CRLF)
Loop
EndIf
$AktivDir = Dir()
Loop
CD "\"
Close($Handle)
Next
Close($HandleOutput)