Sh4dow Posted April 19, 2005 Author Posted April 19, 2005 Yzöwl - I hardly understand your last post. I couldn't write a loop if you paid me 1 million bucks!!
Sh4dow Posted April 19, 2005 Author Posted April 19, 2005 Here are the 3 words/acronyms that I am looking for: FBI Iowa CIAWhat I am trying to accomplish is if any two or three of these words/acronyms are in any type of file (doesn't have to be a txt file I just thought it would be easier) then I need to know the file name and location of the file. I have to search a server that has 300GB of data on it.
Yzöwl Posted April 19, 2005 Posted April 19, 2005 Okay then, here is some complete code. (they are in the zip attached too!)This will get every file containing all three of your search strings and open the results in your default text editor!All you need to do is keep the two files together in the same directory, open the cmd prompt in that directory and typeget3 Drive:\PathDon't forget to use quotes if Drive:\Path contains spaces!get3.cmd@ECHO OFFIF %1 EQU "" ECHO You must provide a directory to check! e.g. %~0 C:\MyFiles && PAUSE && GOTO :EOFIF NOT EXIST "%~1" ECHO The specified directory does not exist! && PAUSE && GOTO :EOFSETLOCALSET STRS="%~dp0_3words.dat"FOR /F "TOKENS=*" %%A IN ('FINDSTR /SIMP /G:%STRS% "%~1\*.*"') DO ( CALL :chk "%%A" >NUL IF ERRORLEVEL 1 ECHO %%A >>"%~dp0all3.txt")IF EXIST "%~dp0all3.txt" START "" /W "%~dp0all3.txt"ENDLOCAL && GOTO :EOF:chkFOR /F "TOKENS=*" %%B IN ('TYPE %STRS%') DO ( FINDSTR /SIMP "%%B" %1 || EXIT /B 0)EXIT /B 1_3words.dat\<FBI\>\<Iowa\>\<CIA\>get3.zip
Sh4dow Posted April 19, 2005 Author Posted April 19, 2005 Yzöwl First off, thank you. That file works perfectly.is there any chance at all that you would explain some of the lines of code that you wrote? It would greatly benefit myself and others
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now