| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Testing for String in Fil |
TP> Can someone post me a snippet of thier code(s) as to
TP> an effective way to :
TP>
TP> . check that a file(s) within a folder(s) contain
TP> a string (ie. I wish to test for 'BFE' in the first
TP> line of the file(s) ..... before using a 'goto' ?
TP>
TP> . Would the 'test' close the file(s) [using fileclose],
TP> before the 'goto' ?
:: assuming you want to check the files in %folder do this ...
for x in (%folder%\*.*) do ( input %%firstline < %x
if %{at}index["%firstline",BFE] ne -1 call dosomething %x)
I've used call here instead of goto incase the folder contains more than one
file with the matching string, you'll need to replace dosomething with a BTM
to do whatever processing you want done. and you can replace %folder% with any
expression naming the folder .... (fyi this way files will be closed)
There are times when fileopen and findfirst can be useful, they are very
rare. I usually find for and input to be more convenient.
bye.
--- EzyQwk V1.20 01fa018d
* Origin: CSS Brisbane, Qld, Australia. [61-7-3367-3890] (3:640/350)SEEN-BY: 396/1 632/0 371 633/260 267 270 371 635/506 728 639/252 @PATH: 640/350 201 270/101 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.