Batch file to check if the specific word “test” exist in the files, IF exist copy the whole folder to another location?

If you want to check all files beneath current folder at any level, add /S switch in findstr command. Do the same in xcopy command to copy the whole folder structure.

Up vote 0 down vote favorite share g+ share fb share tw.

How can I check if the word "test" exist in any files inside a folder(that contain tons of folders and files) .. and if exist, copy the whole folder to another location. Please help thank you windows batch-file cmd xcopy link|improve this question asked Jul 22 '11 at 13:08massaki246 67% accept rate.

Findstr /c:"test" *. Txt > NUL if not errorlevel 1 xcopy *. * anotherlocation If you want to check all files beneath current folder at any level, add /S switch in findstr command.

Do the same in xcopy command to copy the whole folder structure.

This solution only work for . Txt files? – massaki Jul 22 '11 at 22:11 No.

Although it should work in any file, how you expect to find the "test" or any string in a file that not contain text? It depends ultimately on the operation of findstr command, that works on any file. – Aacini Jul 23 '11 at 0:33.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions