We help IT Professionals succeed at work.
Get Started

Windows Batch or VB script to return the directory holding a given file name

382 Views
Last Modified: 2012-05-09
Hi,

There are over 1000 files in our shared drive / folder ;  though there's certain naming
convention, I still find it tough to trace which folder holds say a given filename.

Suppose I want a filename which has the term/text "contacts" in it (as I want to update
person's contact info of a Word Doc), I would normally do  at Windows MSDOS prompt :
a) dir/s z:\ > c:\temp\shdrv.txt
b) use Wordpad to search for the string "contacts"

Now, since I have a scheduled task to update shdrv.txt daily to my c:\temp
I'll need a script that could help me read the file shdrv.txt & then return all
the various occurrences of the filenames (with their date of creation/modification)
with the string "xxxxxxx" plus the directories that hold each of the filenames that
contain the string "xxxxxxx".

Using "find/I "string" shdrv.txt" returns the filenames but is missing on the
directories that hold the files
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 3 Answers and 28 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE