Pergunta

Description:
Since my previous post of using a .bat file to search for file names (Find multiple files from the command line),
I have figured out how to run a .bat file to search a server for specific file names. Now, I want to do the same thing but I want to include in my search the entire contents of a directory.

All of this will be done in windows command prompt and of course a notepad file if needed. I do not have access to linux or unix so please no responses that include such.

Example -

I Drive
+Drawings
++Structural

So for the example above I want to take the entire contents of dir structural (which may be 1000s of .dwg) and using a .bat file search a server with it.

Also I put these commands in notepad and renamed it from a .txt to a .bat

My single file search

dir [file.dwg] /s/4

Entire Directory Search (which does not work this is what I am trying to do)

dir [original dir] /s/4

After i finished writing my .bat file in notepad I would simply put it in the server directory location that I needed to search and run it.

I hope I have made myself clear and I hope that you can help because Im not sure what to do here.

See(Folder Comparisons Via Command Line) for what I am trying to do only I need to compare the directory and all sub directories.

Foi útil?

Solução

In an effort to understand what you want, here is an example batch file:

DIR G:\Structural /S /B
G:\Structural\cad2012.dwg
G:\Structural\cad2013.dwg
G:\Structural\cad2014.dwg
G:\Structural\photo2012.jpg

If you just want to find the files with 2012

DIR G:\Structural /S /B   | FINDSTR 2012
G:\Structural\cad2012.dwg
G:\Structural\photo2012.jpg

If you just want to find the dwg files from 2012

DIR G:\Structural /S /B   | FINDSTR 2012 | FINDSTR /R /I dwg$
G:\Structural\cad2012.dwg

Outras dicas

Have a look at what I wrote in response to the question "batch file - Compare in windows command prompt" which I think is getting close to what you want to do.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top