Question

Description:

I am searching a very large server for files that is on a different server. right now I open command prompt and type

DIR [FILE NAME] /S/4

This returns the server location of the file with some other stuff that is not really needed.

Question:

I have a lot of files to search and one by one input into the above command could take forever. Is there a way I could input all of the names of all the files and only search once and the search results would only need to show file name and location?

Was it helpful?

Solution

First, I hope you don't mean DOS, but rather Windows cmd or batch.

You can certainly write a script that will run your DIR command once per file being sought.

But what you most likely want instead is to search once and print the path of each file found. For this you can use PowerShell's FindChildItem or the improved one posted here: http://windows-powershell-scripts.blogspot.in/2009/08/unix-linux-find-equivalent-in.html

It will be something like:

Find-ChildItem -Name "firstfile.txt|secondfile.txt|..."

Another approach is to install msys or cygwin or another Linux tools environment for Windows and use the Linux find command.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top