Search one relevant string among all files

Within the following place (within Fig 1),

I want to ensure it is to search every file inside the above folder for the relevant string highlighted? Is there a way for this? (Please see Fig 2)
t500.png
t501.png
LVL 11
Who is Participating?

Please take files you are certain contain the string and put them in a directory by themselves with a couple files you are certain do not have the string.

Then point the script to them and run It again.

I have taken the echo to the file out, and placed a pause in the script so everything will output directly to the cmd window and it will sty up once it completes running.

:: Script Name: SearchFilesFor.bat
:: Version: 1.2.0
:Begin-Script
@(
SetLocal
Echo Off
)

:Set-Variables
Set "SPath=\\hkgedi2\_r$\Booking\LocalHKG\cn_iftmbf\Data\in\archive" Set "SFiles=*.edi" Set "SString=SZSE1308040" Set "LFile=C:\SearchFilesFor.log" :Start-Main echo.Script Begun On: %Date% at %Time% FINDSTR /P /I /M /D:"%SPath%" "%SString%" "%SFiles%" GOTO :End-Script :End-Script echo. echo.Script Completed on: %DATE% at: %TIME% pause EndLocal&Exit /b 0  0 Commented: Windows search indexing could do it. F3 search for content within the files You could get unix tools for windows and use egrep -il "word" * 0 Business AnalystAuthor Commented: Thanks. which unix tool to use for this? 0 Commented: 0 Business AnalystAuthor Commented: Is it to take UnxUtils.zip ? But I've got these An error has been encountered in accessing this page. 1. Server: unxutils.sourceforge.net 2. URL path: /UnxUtils.zip 3. Error notes: NONE 4. Error type: 403 5. Request method: GET 6. Request query string: NONE 7. Time: 2013-09-03 03:47:35 UTC (1378180055) Reporting this problem: The problem you have encountered is with a project web site hosted by SourceForge.net. This issue should be reported to the SourceForge.net-hosted project (not to SourceForge.net). If this is a severe or recurring/persistent problem, please do one of the following, and provide the error text (numbered 1 through 7, above): Contact the project via their designated support resources. Contact the project administrators of this project via email (see the upper right-hand corner of the Project Summary page for their usernames) at user-name@users.sourceforge.net If you are a maintainer of this web content, please refer to the Site Documentation regarding web services for further assistance. NOTE: As of 2008-10-23 directory index display has been disabled by default. This option may be re-enabled by the project by placing a file with the name ".htaccess" with this line: Options +Indexes 0 Commented: Unfortunately, I do not have influence/control over sourceforge. The second link I provided has reference to other tools. Your windows setup might not have search indexing enabled, or was corrupted by installation of the many desktop search tools from bing, yahoo, google, etc. http://www.microsoft.com/en-us/download/details.aspx?id=35844 0 Business AnalystAuthor Commented: when doing Indexing options, do we have to choose the relevant network path? t502.png 0 Commented: You seem to have archive mapped as drive, include that. Make sure you have enough space n c:\ for the index. Or you might wish to relocate the location index. There are document management systems that include indexing as well as versioning thatyou might want to consider for future use. 0 Business AnalystAuthor Commented: Sorry, how to add the relevant path within the following? t503.png 0 Commented: Just noticed, you want to search through LDD files. What creates those files in your environment? 0 Business AnalystAuthor Commented: Yes, those are some incoming file got from outside. thanks 0 Commented: If you open any of the files using notepad, can you see/read data or is it in binary format? If these are binary data file, you would need to create a vbscript/powershell script that can extract the data from these files and create your own indexing scheme. 0 Business AnalystAuthor Commented: How about that I only expect to search any files with extension of .edi? What to add to Indexing options? 0 Commented: The difficulty is that the data is in an unknown format to me. Try the windows desktop search tool. or the yahoo/google ones. Often, indexing services are recomended to be disabled. see whether you can open the file and see whether it is in human readable format. 0 Business AnalystAuthor Commented: All files inside the path are readable in Notepad, which means they're all in Text format. 0 Commented: As part of the indexing setup you could exclude extensions from being indexed (exclude) which is a pain since in your case you are only interested in a few (two) extensions. You have a few shared/network drives in the index queue, but this one is not. A discussion deals with setting up indexing and then overlaying the network resource onthatpath, or making sure the archive is partf the available offline option. http://social.technet.microsoft.com/Forums/windows/en-US/afb904c1-1c61-4aae-b6b1-5cf525b9f8de/how-do-i-get-windows-7-to-index-a-network-mapped-drive Another option is to use IIS on the sharing system with a web based interface that will index the share. Setup indexing on the server and use a web page to access/query the indexing service on the server. 0 Business AnalystAuthor Commented: Many thanks. Do you know if we have to also have index on Windows 2003 for doing the search? I now do the search in another Win 2003 server, inside which, the below file is residing https://dl.dropboxusercontent.com/u/40211031/t504.png Also inside the above file, I can see this string part https://dl.dropboxusercontent.com/u/40211031/t505.png But when I further search the folder with these options https://dl.dropboxusercontent.com/u/40211031/t506.png I get nothing found. What is the reason of this? 0 Commented: It is difficult to say. You can try not specifying the filename criteria while allowing the search for a text only. On win2k3 indexing was discouraged, if you do enable it, limit the folders on which it runs. If memory serves me, the main issue was not to include c:\ c:\windows in the indexing. The following discuss on providing access to the indexing service via a web nterface using asp/asp.net Http://support.microsoft.com/kb/820983 http://support.microsoft.com/kb/820105 http://technet.microsoft.com/en-us/library/bb727099.aspx 0 Lead Network EngineerCommented: Indexing should be avoided on any system folders or folders which contain data at a high rate of change. If all you want to do is run a windows search in files simply turn off the requirement that the search can only look inside indexed files in the search options. Its as simple as unchecking the check box and then re-running your search. 0 Business AnalystAuthor Commented: Thanks all. Arnold, I put 'ZIMHK' instead of "*.*" for file name but I still get the same. Why? 0 Commented: What happens if you do not include a filename search parameter? 0 Lead Network EngineerCommented: Not to side-track things, but one thibg I always found a lot quicker than the windows search in windows 2003 and prior was to use the funduc "Search and Reolace" utility. (Its still faster in newer OSes, however not by such a large degree) In windows 2003 and prior the default search was still the old search service powered by the indexing service which was disabled in windows 2003 by default as a best practice. As I recall in order to get results within files at all on windows 2003 you needed to either install the desktop search ad-in (which later became the standard search except paired down and integrated into the OS )or turn on indexing in order to get results within. That said although it is available in windows update don't install the desktop search it will create huge indexes, or if you install it, limit it to the specific directory in which you wish to see the contents of files. Its probably better to turn on the default indexer service just so you can actually perform the search looking inside files and then turn it off again when done. 0 Business AnalystAuthor Commented: Thanks all. Arnold, I put nothing for file name but I still have got "No results". QCubed, I can only touch (set up something) on my own local Win 7 machine and better not to touch that Win 2003 server. I finished rebuilding the indices on this Win 7 machine but why did I still encounter the same problem? 0 Business AnalystAuthor Commented: Any help? 0 Business AnalystAuthor Commented: Any help? 0 Commented: Sorry, Going back to the earlier (much earlier suggestion to get the unixtools) Misread your earlier post, the error page has a reference to the new project URL http://unxutils.sourceforge.net which redirects to http://sourceforge.net/projects/unxutils/ where you can download the zip. After you extract the files in unxutils\usr\local\wbin\ using the full path <where extracted>\unxutils\usr\local\wbin\grep -lir "pattern" where_you_want_to_search the -r will cause grep to recursively process every subfolder. 0 Lead Network EngineerCommented: If tools or command line is acceptable (instead of windows search gui) then you can easily accomplish this through CMD natively both locally on the server or remotely through the network, without downloading anything. The below command and script will perform the same function: Search a path for all files matching a file pattern "*.LDD" and return the names of any files which contain the string you are looking for. AT THE CMD PROMPT:  FINDSTR /P /I /M /D:"\\Server\Share\Folder\Folder" "0032655" "*.LDD"  AS A SCRIPT (Only because it's easier for editing and re-running the script if you need it again.): :: Script Name: SearchFilesFor.bat :: Version: 1.2.0 :Begin-Script @( SetLocal Echo Off ) :Set-Variables Set "SPath=\\Server\Share\Folder\Folder" Set "SFiles=*.LDD" Set "SString=0032655" :Start-Main FINDSTR /P /I /M /D:"SPath" "%SString%" "%SFiles%" GOTO :End-Script :End-Script echo. echo.Script Completed on: %DATE% at: %TIME% EndLocal&Exit /b 0  PS: I wrote the above post on my phone, so it's possible there may be some syntax issues. NOTE: There is No Trailing \ on the folder path. NOTE: The Command Switches Used -- "/P" skips non ASCII Files -- "/I" is case insensitive -- "/M" Finds one match, then prints the name of the file, without looking for any further matches -- "/D:" Directory path (or paths separate by commas) to search. Also: My examples use network paths, but you can change them to local paths if you want to check the local server instead, just change "\\servername" to "DriveLetter:' (eg. "\\myserver\c$" becomes "C:" on the local machine) again, no trailing \ on your folder path.

If you want to get more advanced FindStr offers the option to return additional information such as # of occurrences of the string in the file and what line numbers.
0

When I joined this topic, the native command line file searching seemed the easiest way to get the info you wanted, but I thought you were stuck using the GUI for some reason, my apology.

I have taken the time to test the above code, and there was one small miss on Syntax in the script.

I have also amended the code below to write all of their output to a log file that you can then read in notepad (Easier to review if you have a lot of files that match.)

CMD PROMPT (Past Command in to CMD to Run):
FINDSTR /P /I /M /D:"\\Server\Share\Folder\Folder" "0032655" "*.LDD">>"C:\SearchFilesFor.log"

SCRIPT FILE (Save in Notepad as "SearchFilesFor.bat" and double-click to run):
:: Script Name: SearchFilesFor.bat
:: Version: 1.2.0
:Begin-Script
@(
SetLocal
Echo Off
)

:Set-Variables
Set "SPath=\\Server\Share\Folder\Folder"
Set "SFiles=*.LDD"
Set "SString=0032655"
Set "LFile=C:\SearchFilesFor.log"

:Start-Main
FINDSTR /P /I /M /D:"%SPath%" "%SString%" "%SFiles%">>"%LFile%"
GOTO :End-Script

:End-Script
echo.
echo.Script Completed on: %DATE% at: %TIME%
EndLocal&Exit /b 0


More Notes:

To Output to the screen again remove the portion of the Code from ">>" to the end of the line.

If you want to actually see the line which has the text for every file that matches just remove the "/M"

If you have thousands of files you may want to change the default properties of the command prompt to 9999 lines of scroll-back, as by default CMD only retains 300 lines of scroll-back. (I Change this on every system I work with.)
0

Many thanks. I did try this batch

:: Script Name: SearchFilesFor.bat
:: Version: 1.2.0
:Begin-Script
@(
SetLocal
Echo Off
)

:Set-Variables
Set "SPath=\\hkgedi2\_r\$\Booking\LocalHKG\cn_iftmbf\Data\in\archive"
Set "SFiles=*.edi"
Set "SString=SZSE1308040"
Set "LFile=C:\SearchFilesFor.log"

:Start-Main
FINDSTR /P /I /M /D:"%SPath%" "%SString%" "%SFiles%">>"%LFile%"
GOTO :End-Script

:End-Script
echo.
echo.Script Completed on: %DATE% at: %TIME%
EndLocal&Exit /b 0

I then wait for 4/5 hours but I still get no output in the relevant log file.
0

Can you confirm that any of the files actually contain the string? I tested the batch file before hand and it worked with all the test files I created.

Remove the " >> filename " and run it at the command prompt. Make sure you place at least 1 file in the directory you know contains the string
0