Computing.Net > Forums > Disk Operating System > Find a string in all subdirectories

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Find a string in all subdirectories

Reply to Message Icon

Name: gino1
Date: February 18, 2003 at 16:39:43 Pacific
OS: DOS 6.2/Win 2000
CPU/Ram: 486/586
Comment:

Hello!

I´d like to make a program (.bat) in which the user types a certain string and the program should search it in ALL Files from the current directory and it´s subdirectories, also showing the path were it finds it.

Thanks in advance!



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: February 19, 2003 at 09:36:46 Pacific
Reply:

The following script will do the task on Windows 2000 and XP.

@echo off
if not "%1"=="" goto start
echo.
echo This batch script will look for a string on all the files
echo from the current directory and its subdirectories.
echo.
echo Sintax: %0 string
echo.
goto eof
:start
for /R %%F in (*.*) do (
    FIND "%1" < %%~sF > nul
    if not errorlevel=1 echo String found on %%~fF
)
:eof

That script will FAIL on DOS6.22. The same task can be achieved on that OS, but much more work is involved.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Find a string in all subdirectories

Exectute a prg in all Subdirectorie www.computing.net/answers/dos/exectute-a-prg-in-all-subdirectorie/13350.html

How save in a file a find for strin www.computing.net/answers/dos/how-save-in-a-file-a-find-for-strin/11347.html

length of a string in a batch file www.computing.net/answers/dos/length-of-a-string-in-a-batch-file/13650.html