With names embedded in the titles, how to search for them?

April 12, 2019 at 16:06:20
Specs: Windows 10
With file names like, "G005 Smith_Jones.cbh", I still need to find, eg., all files with the name "Jones" in them. This is tricky presumably because of the space after the initial numbers used (eg., "G005"), as well as the underscore between the two names.
(They are names of competitors, so it is necessary to be listed like this.)
I need help refining the DOS batch file I use for that.
Here is a sample of what "sort of" works:
=============================
@echo off
echo.
echo Search system for specific files.
echo.
timeout /t 3 /nobreak
cls
echo.
dir /o:n /p *Jones*.cbh
echo.
timeout /t 4 /nobreak
echo.
REM *** DON'T use the extension descriptors (eg., ".cbh") in line below ***
findstr /i /m /s "Jones" "D:\Vault\*.*" > C:\Users\Desktop\Files_found.txt
echo.
exit
=============================
What often happens is that I get a return of tons of file names which have nothing to do with the actual names I'm searching for! So, this is useless as written above.
How do I correct it (limit it to actual spec names required)?

Thank you,
Richard


See More: With names embedded in the titles, how to search for them?

Reply ↓  Report •

#1
May 23, 2019 at 17:07:12
Hi Zapranoth, I do not know the answer to this, however suggest experimenting with the DIR Command.

eg DIR *Jones*.*

Bear in mind DOS Batch is a script, which is simple programming, and may not be powerful enough (or contain errors) such that it does not work in the way you require.
Also it is very old and has been upgraded (supposedly) to handle Windows File naming conventions.

I believe Linux is able to interrogate File Names better.

Good Luck - Keep us posted.


Reply ↓  Report •

#2
July 22, 2019 at 05:58:44
You just need to change :

dir /o:n /p *Jones*.cbh

into

dir /o:n /p "*Jones*.cbh"

message edited by Looge


Reply ↓  Report •

#3
July 22, 2019 at 06:23:39
@Mike - The "DOS" in Windows 10 is called "Windows CMD"

Although being based on DOS, it has been upgraded in time to comply with many "new" features. Like for example the existence of white-spaces in file names.

You're right stating being simple, but it is powerful enough to cover for a lot of features. The command line will ALWAYS be the underrated feature of any Windows, and for that reason it will be conceived as not being powerful.

Note that PowerShell is introduced as standard software in the Windows 10 (and support as optional in Windows 7) and that one definately is more powerful. It depends to what you compare.


Reply ↓  Report •
Related Solutions


Ask Question