|
|
|||||||
Hi All this is my first post for help... Here is the situation. I have mutliple folders... from 000000 and counting up in increments of 1 (000001,000002 etc) In each folder i have a text file that is the same name and format and I need to read line 10 from each folder and put all the results into a single output file IE. I have a folder called D:\OUTPUTS In that I have all these counting up folders (000000,000001 etc) Find entry in line 10 in file info.txt in each folder. (but trim the first 3 chars off the file and output those all to a single txt/csv in the root of d:\outputsinfo.txt Can anyone please help to assist in the counting... I have this so far... works for one file... nothing to count each folder up Code: Break On $folder = "000000" $ffh = FreeFileHandle() If Open($ffh, "d:\Outputs\" + $folder + "\info.txt") = 0 $line = ReadLine($ffh) While @ERROR = 0 $count = $count + 1 If $count = 11 $trimmed = Right($line, Len($line) - 3) ? $trimmed EndIf $line = ReadLine($ffh) Loop $RC = Close($ffh) EndIf |
||||||||
|
|
|||||||
Here is something you can work on. *Untested*, and I might have done it a different way if I had more details. Code: Break On $ffh = FreeFileHandle() if open($FFH,"D:\outputsinfo.txt",5)=0 for $i=0 to 1000 $folder = right("000000" + $i,6) $ffh2 = FreeFileHandle() If Open($ffh2, "d:\Outputs\" + $folder + "\info.txt") = 0 $line = ReadLine($ffh2) $count=0 While @ERROR = 0 $count = $count + 1 If $count = 11 $trimmed = Right($line,-3) ? $trimmed $RC=Writeline($FFH,$trimmed) EndIf $line = ReadLine($ffh2) Loop $RC = Close($ffh2) EndIf next $RC=close($FFH) endif |