Command line to search for all word files using wildcards in filename

0

How can I find all files that have a name like ALPS*.doc in a folder like P:\Systems\A.L.P.S\?

I tried this using the command line but it returns zero:

Systems\A.L.P.S>dir /s /b c:\ |find /c "\ALPS*.doc"

What am I doing wrong?

Our Man in Bananas

Posted 2014-10-13T12:16:56.757

Reputation: 226

Answers

1

You can directly specify what to list in the directory from the dir command itself.

So you would use this command:

cd /d c:\
dir /s /b ALPS*.doc

You first navigate to the root, then search recursively from there.

Do note that searching from C:\ will only find results in C:. If you want to search in P:\Systems\A.L.P.S, you of course have to search from that folder. the first line would then be:

cd /d p:\Systems\A.L.P.S

LPChip

Posted 2014-10-13T12:16:56.757

Reputation: 42 190

thanks, so is there a way of just getting a count of all the files with a name like ALPS*2013*.doc ? – Our Man in Bananas – 2014-10-13T14:06:30.727

is there a way of counting all the files without listing them, or do I have to output them to a (text) file? – Our Man in Bananas – 2014-10-13T14:16:13.223

If you do not care for the filenames, you can ommit the /b which gives a detailed result including the filesize per file, but also a summery at the end stating how many files were found and what its size is. – LPChip – 2014-10-13T17:34:38.477

1Alternatively, you can use this command: dir /s /b ALPS*.doc | find /c "ALPS" assuming ALPS is not written twice in the name. – LPChip – 2014-10-13T17:37:46.130

0

Within Powershell.

Get-ChildItem C:\ -Recurse "ALPS*.doc"

Ross

Posted 2014-10-13T12:16:56.757

Reputation: 81