Avatar of William_Conway
William_Conway

asked on 

BATCH FILE NEEDED

I need a batch file to search a directory ful of *txt documents to see if these txt documents contain a certain string  - if they do contain the string within the document i then need to copy them to another directory
Microsoft DOSSQL

Avatar of undefined
Last Comment
sirbounty
Avatar of sirbounty
sirbounty
Flag of United States of America image


for /f %%a in ('findstr /i /m YourString *.txt') do copy %%a c:\Destination /y

The /y is to auto overwrite, remove it if that's not what you want...
Avatar of William_Conway
William_Conway

ASKER

Hey sirBounty that looks good - one thing i dont understand though if i want toinput the souce directory to serach and have it different to the destination directory how do i do this?
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of William_Conway

ASKER

Excellent - good one SirBounty much appreciated.
Avatar of sirbounty
sirbounty
Flag of United States of America image

Happy to help - thanx!
SQL
SQL

SQL (Structured Query Language) is designed to be used in conjunction with relational database products as of a means of working with sets of data. SQL consists of data definition, data manipulation, and procedural elements. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control.

61K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo