Search for files that do NOT match a search term.

User avatar
pmatz
StarLounger
Posts: 71
Joined: 20 Feb 2010, 10:31
Location: UK

Search for files that do NOT match a search term.

Post by pmatz »

Hi.

I would have thought this was simple, but I'm stuck. Probably missing something simple.

I want to search through my whole music directory, including all subfolders, for any files that do NOT match the *.mp3 search.

Whats the easiest way?
thanks, Paul.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Search for files that do NOT match a search term.

Post by HansV »

I don't know how to do this with the standard Start | Search option in Windows XP. You can do it in a command prompt window, for example

dir "C:\Documents and Settings\<username>\My Documents\My Music" /s | find /v /i ".mp3"

The first part dir ... /s lists all files in the specified folder and its subfolders.
The pipe character | passes the results to the second part find /v /i ".mp3"
The /v parameter specifies that find should look for lines NOT containing the search text ".mp3".
The /i parameter specifies that the search is not case sensitive. Without this, Hey Jude.MP3 would still be found because the extension is upper case.
Best wishes,
Hans

User avatar
pmatz
StarLounger
Posts: 71
Joined: 20 Feb 2010, 10:31
Location: UK

Re: Search for files that do NOT match a search term.

Post by pmatz »

perfect! thanks :o)
thanks, Paul.

jaystarter
3StarLounger
Posts: 246
Joined: 09 Feb 2010, 09:01
Location: Southeast England

Re: Search for files that do NOT match a search term.

Post by jaystarter »

Excellent! learnt another handy tip.
Jeff

User avatar
pmatz
StarLounger
Posts: 71
Joined: 20 Feb 2010, 10:31
Location: UK

Re: Search for files that do NOT match a search term.

Post by pmatz »

Ok, have finished my script to perform this type of search. It gives a textfile output which it plonks on the desktop.
folderNOTSearchRecurse.zip
I think it's error free now... seems to work perfectly for me.

The DIR cmd is very handy to know, but sifting through the verbatim was tedious! This gives me a nice concise report.

Thought to share it, if helpful. :grin:
You do not have the required permissions to view the files attached to this post.
thanks, Paul.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Search for files that do NOT match a search term.

Post by HansV »

Thanks!
Best wishes,
Hans