# dir command in dos not working with wildcards to remote server



## krazeecrw (Oct 25, 2002)

Hello-

We have been trying to run a command on one server to a remote server to search for a file. The command we run is

Dir /b \\<server_name>\c$\archive\test\csv\MPRep_??????????????.csv

Aftter running this command we see the below results:

MPRep_20100611020000.csv
MPRep_20100611020000.ri.csv

This should only be returning the top item. If we run the same command on the local machine, just the first file shows properly.

Any explanation on the different results when running from a remote server?

Is there any type of program available that would all us to use the Linux command (ls) instead?


----------



## Squashman (Apr 4, 2003)

I know TheOutCaste and I were testing this out a few months ago and he found a nice article about wildcard usage in dos. 

There are plenty of native ports of the nix command line for Windows. Just Google search and you should be able to find them


----------



## DaveDoesIT (Aug 24, 2008)

Just a thought, have you tried using quotations around the filename?

Dir /b \\<server_name>\c$\archive\test\csv\"MPRep_??????????????.csv"

Dave


----------



## TheOutcaste (Aug 8, 2007)

If you have a ? wildcard before a period, and that wildcard is in the 8th or later position, it acts like the *
These three search patterns will return the same results:
*MPRep_??.csv
MPRep_??????????????.csv
MPRep_*.csv*

Specifying a specific number of characters using the ? only works if the file name is 7 characters or less, or you have a character before the period.
This is what you need if you only want to return the first result:
*MPRep_?????????????0.csv*

Of course the last character before the . must be a zero.


----------

