Computing.Net > Forums > Windows XP > Batch Script for finding the files

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.

Batch Script for finding the files

Reply to Message Icon

Name: ufriends
Date: May 14, 2008 at 12:50:19 Pacific
OS: Win XP
CPU/Ram: Intel 2G
Product: Intel
Comment:

Hi,
I am new to scripting so excuse me if I am anything silly.
I need a batch script and my requirement is as follows:
I have some file names (around 30)and I can put them in a text file (say test1.txt) and I want a script to search these files in C: drive and as a output generate a text file which says filename1 YES (means its present) otherwise say filename1 NO.

If anyone can help me I would be highly thankful.

Thanks,
Uttam



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: May 14, 2008 at 13:25:17 Pacific
Reply:

Save the following batch as e.g. look.bat

@echo off
for /f "tokens=* delims=" %%j in (test1.txt) do (
dir /S /B "C:\%%j" | find /I "%%j" > Nul
if errorlevel 1 (echo."%%j" NO) else (echo."%%j" YES)
)
:: End_Of_Batch

then type at prompt

look > out.txt

and you get your list in out.txt.


0

Response Number 2
Name: ufriends
Date: May 15, 2008 at 15:09:50 Pacific
Reply:

This is awesome!! Thanks for all your help.


0

Sponsored Link
Ads by Google
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 Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Batch Script for finding the files

sysdrv: system cannot find the file www.computing.net/answers/windows-xp/sysdrv-system-cannot-find-the-file/105873.html

Batch Script to extract the child files www.computing.net/answers/windows-xp/batch-script-to-extract-the-child-files/180313.html

Batch Script www.computing.net/answers/windows-xp/batch-script/176090.html