Windows - Search for Files that Do NOT Contain a Certain Term [closed]
Asked Answered
S

7

7

How would I search for anything in a certain directory that doesn't contain a certain term?

For example:

!(FINAL)

or

NOT(FINAL)

I would like to find anything (files only) that doesn't contain the term FINAL in the title in Windows XP. Is this possible?

Many thanks.

Stereophonic answered 16/7, 2012 at 9:55 Comment(0)
T
4

Windows Command Prompt

To do this with Windows Command Prompt, CMD.

Start -> Run -> Type "cmd". use "cd" to change to your working directory and enter:

dir | findstr /v /i "FINAL"

This will list all files and folders which do not have the word "FINAL" in the title.

dir /a:-d | findstr /v /i "FINAL"

This will list all files which do not have the word "FINAL" in the title.

POWERSHELL

It is possible to do this with Windows PowerShell.

Get-ChildItem -exclude "*FINAL*"

This will list all files and folders which do not have the word "FINAL" in the title.

Get-ChildItem -exclude "*FINAL*" | where { ! $_.PSIsContainer }

This will list all files which do not have the word "FINAL" in the title.

You may need to download and install Windows PowerShell from here if your installation of XP does not already have it. Windows XP Powershell

Useful Links.

Troglodyte answered 16/7, 2012 at 13:3 Comment(2)
@MobyDisk You are stating this weirdly - stdin is a file descriptor that can represent a file, or input into the program. A list of files from dir piped to stdin looks the same as if you "cat"-ed a file that contained a list of files. Long and short, there is nothing wrong with the above pipe.Newel
The windows command can be augmented with /S to get subdirectories. "dir /A-D /S". The colon is optional.Newel
C
16

You can search for * NOT *FINAL* for example to find anything without the string final in it

Cheadle answered 20/3, 2014 at 10:4 Comment(1)
The benefit of this answer and siryx answer below (either using NOT or using minus sign - inside the Windows Explorer search GUI tool) is that you can turn on Advanced Options > In non-indexed locations > File contents to search within the contents of text documents and find those missing certain text, not just searching inside the document title.Jewett
F
8

If you are looking for something right from your explorer window, I just did some research since these answers here didnt suffice to me.

To find all php files which do not have "decoded" in their name, I put the following in the search field:

*.php -Decoded

Hope this helps!

Falcon answered 20/5, 2019 at 9:8 Comment(0)
P
5

In Windows File Explorer Search Box, type: -

NAME:AAAA (to find documents with AAAA in the title)

NAME:AAAA AND NAME:BBBB (to find documents with both AAAA and BBB in the title)

NAME:XXXX AND NOT:YYY (to find documents with XXXX in the title, but not YYY)

Pinhole answered 22/8, 2021 at 22:4 Comment(0)
T
4

Windows Command Prompt

To do this with Windows Command Prompt, CMD.

Start -> Run -> Type "cmd". use "cd" to change to your working directory and enter:

dir | findstr /v /i "FINAL"

This will list all files and folders which do not have the word "FINAL" in the title.

dir /a:-d | findstr /v /i "FINAL"

This will list all files which do not have the word "FINAL" in the title.

POWERSHELL

It is possible to do this with Windows PowerShell.

Get-ChildItem -exclude "*FINAL*"

This will list all files and folders which do not have the word "FINAL" in the title.

Get-ChildItem -exclude "*FINAL*" | where { ! $_.PSIsContainer }

This will list all files which do not have the word "FINAL" in the title.

You may need to download and install Windows PowerShell from here if your installation of XP does not already have it. Windows XP Powershell

Useful Links.

Troglodyte answered 16/7, 2012 at 13:3 Comment(2)
@MobyDisk You are stating this weirdly - stdin is a file descriptor that can represent a file, or input into the program. A list of files from dir piped to stdin looks the same as if you "cat"-ed a file that contained a list of files. Long and short, there is nothing wrong with the above pipe.Newel
The windows command can be augmented with /S to get subdirectories. "dir /A-D /S". The colon is optional.Newel
D
1

For what is worth, if you do have Total Commander (https://www.ghisler.com/index.htm), it has a pretty good search functionality. It is able to look into files and has an explicit checkbox "Find files not containing the text"

(note: I am not affiliated with Total Commander in any way, but it is a good tool)

Dibru answered 29/4, 2020 at 10:38 Comment(0)
D
1

In Windows 10 file explorer...

green NOT blue (Shows all files with "green" in the name, but not files with "blue" in the name)

. NOT backup (Shows all files containing a period(.) before the file extension(which should be all of them), but not files containing the word "backup")

Dendroid answered 6/4, 2023 at 2:34 Comment(0)
M
0

You can use a code like this:

grep -rin "find-what?" ./

You need cmd-bash for this. Makes the work easier!

Messenger answered 16/7, 2012 at 10:5 Comment(1)
Thanks for this, but I was hoping for something that could be applied directly from the Windows Explorer window. Any other suggestions?Stereophonic

© 2022 - 2024 — McMap. All rights reserved.