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
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.