Solved

Batch to find/delete

Posted on 2014-09-04
2
305 Views
Last Modified: 2014-09-04
Hello,
Can you please help,
I have few .txt files in a specific  Directory.
C:\Users\Wassim\__Task_Schedules\_Files_FTP

One of the text files contains a string
HResult 0x35, Level 16, State 1

How can I delete this file through a batch command.

thanks
0
Comment
Question by:W.E.B
2 Comments
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40304819
In a batch file (.cmd or .bat):
@echo off
for %%F in (C:\Users\Wassim\__Task_Schedules\_Files_FTP\*.txt) do ^
find <"%%~F" "HResult 0x35, Level 16, State 1" >nul && del "%%~F"

Open in new window

You can run this at the prompt if you replace each %% by % .
0
 

Author Closing Comment

by:W.E.B
ID: 40304840
Thanks you very much.
Exactly what I needed.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question