0

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.

Community
  • 1
  • 1
user2444074
  • 137
  • 3
  • 6
  • 14
  • It is very unclear what you are trying to do - to me at least. What is your actual question? Are you running on the server or remotely or has the fact that it is a server got nothing to do with anything? What is your "search.bat" supposed to do because it doesn't search? How does dropping a file in a location search anything? What has Notepad got to do with it? – Mark Setchell Mar 04 '14 at 20:20
  • I tried to clarify what i am actually trying to do, see changes above – user2444074 Mar 04 '14 at 20:34

2 Answers2

0

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
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • close, so I want to take your entire dir g:\Strucural (including every file within the directory) and search another dir z: with that information. – user2444074 Mar 04 '14 at 20:41
  • Huh? What do you want to find in Z:? And how will you use what you found in G:\? – Mark Setchell Mar 04 '14 at 21:46
  • basically dir g and dir z may have many duplicates. Im trying to see if this is the case. If it is the case I want to record where in z are the things in g – user2444074 Mar 04 '14 at 21:53
  • Please see the additional link I provided in my problem statement however i want to see if one file in in another location – user2444074 Mar 04 '14 at 21:57
  • Mmmmm... you didn't even mention the word "compare" in your original post. Actually, I answered a very similar question to this for another user, so please have a look here http://stackoverflow.com/questions/20248082/binary-compare-all-files-against-all-files-in-a-specified-directory-and-subdire/20248223#20248223 – Mark Setchell Mar 04 '14 at 22:22
0

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.

Community
  • 1
  • 1
bugmagnet
  • 7,631
  • 8
  • 69
  • 131