>>>How do I delete all text files in c:\texter which have the word KANG in the file contents
>>>
>>>Thanks
>>>
>>>Colin
>>
>>How big are the files? Are they .txt files? Do you want to do this using VFP code?
>>
>>If so, loop with adir, filetostr, check the string and then delete.
>
>This is my current code which gives me all the files - what does the filetostr line look like and where doe it go?
>
>lnFiles = Adir(arrTextFiles1, 'c:\program files\smartserver3\track\*.txt')
>For ix = 1 To lnFiles
>
> Append Blank
> Append Memo myMails From ('c:\program files\smartserver3\track\'+arrTextFiles1[ix,1])
>Endfor
>
>Thanks
>
>Colin
lnFiles = Adir(arrTextFiles1, 'c:\program files\smartserver3\track\*.txt')
For ix = 1 To lnFiles
lcString = filetostr('c:\program files\smartserver3\track\'+arrTextFiles1[ix,1])
if 'KANG' $ lcString
try
erase ('c:\program files\smartserver3\track\'+arrTextFiles1[ix,1])
catch to loError
endtry
else
Append Blank
Append Memo myMails From ('c:\program files\smartserver3\track\'+arrTextFiles1[ix,1])
endif
Endfor
If it's not broken, fix it until it is.
My Blog