Computing.Net > Forums > Programming > Bat file to del *.txt IF word NOT e

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Bat file to del *.txt IF word NOT e

Reply to Message Icon

Name: joe_atkinson
Date: November 30, 2008 at 19:46:27 Pacific
OS: XP
CPU/Ram: 2Gb
Product: Dell D630
Comment:

Guys,

I need your help.

I would like to know what the command lines are for a batch file to 1) read a named text file in c:\ and then delete this text file IF a certain word isnt there.

i.e. Each day apples.txt is saved to c:\, I want the batch file to run and delete the whole file IF and only IF the batch file does not contain the word "lemons"




Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 30, 2008 at 22:38:32 Pacific
Reply:

find "lemons" < c:\apples.txt > nul
if errorleverl 1 del c:\apples.txt


=====================================
If at first you don't succeed, you're about average.

M2


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Bat file to del *.txt IF word NOT e

Bat file to remove antivirus 2009 www.computing.net/answers/programming/bat-file-to-remove-antivirus-2009/17484.html

Bat file to serarch a word in txt www.computing.net/answers/programming/bat-file-to-serarch-a-word-in-txt/17976.html

BAT file to open multiple windows www.computing.net/answers/programming/bat-file-to-open-multiple-windows/7513.html