Windows - Search for Files that Do NOT Contain a Certain Term - search

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.

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

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!

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.
http://technet.microsoft.com/en-us/library/ee176841.aspx

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)

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)

You can use a code like this:
grep -rin "find-what?" ./
You need cmd-bash for this. Makes the work easier!

Related

Recursively Find Files With Particular File Extension and Content

I'm using Windows 10 and the development folders contain a lot of files, I want to search the entire folder tree for a specific keyword but only specific file types.
The folder contains lots of python scripts I want to search only the python scripts for specific keywords. Is there any way to do this with the Windows file search?
Seems like a pretty big omission on something that is fundamental in search.
What do you mean by keyword? Is that a word, present inside the file? Or is it a part of the filename?
In case it's the part of the filename, you can use file: in the Windows search, like in following example:
file:*keyword*.py
This will show you all files, called *keyword*.py. After you've done that, you might change your Windows explorer's view, clicking on the "View" tab and choose "Details", this will also show you the directory where those files are located.
Let's say you want to search the current folder and all its sub-folders recursively for files with the .py file extension that contain the string bar. Open PowerShell in this folder and enter the following command:
Get-ChildItem -Include "*.py" -recurse | Select-String -pattern "bar" | group path | select name
-Include also supports multiple comma-separated file extensions, e.g.: -Include "*.py","*.xml"

Create/find batch script which performs a 'find and replace' within a directory and sub-directories, for excel files with varied names

I have many files (Excel/CSV) contained in varied layers of sub-folders under a single directory. Many of the files contain a single cell with a common text string, which all need to be updated to a new string. The files all have different names. How difficult would it be to create a (preferably batch) script to search the entire directory (inclusive of sub-directories) for a given text string, replace all instances with a new string, and leave everything else in its place.
I am new to scripting, I have been searching the site and haven't found a solution that has worked for me. I want to stress that I cannot download, install or run third-party software due to security measures, and so applications like FART are out. Is anybody able to provide and input for the creation of something like this, or link me to such a script that already exists? Thanks in advance!!
Robust text editing using pure batch is difficult and slow.
Unless your admin techs have disabled CSCRIPT, you can use my JREPL.BAT - a hybrid JScript/batch text processing utility.
There is no download or installation process required. JREPL.BAT is pure script that runs natively on any Windows machine from XP onward. Simply copy the script into a new file named JREPL.BAT on your local machine.
Once you have your own copy, then all you need is something like the following command, run from the command console:
for /r "c:\your\root\path" %F in (*.csv) do #jrepl "search string" "replace string" /L /F "%F" /O -
I used the /L switch to treat the search as a literal. You may want to drop the /L switch and do a regular expression search instead.
If you put the command within another script, then you will need to double the percents and use CALL JREPL.
#echo off
for /r "c:\your\root\path" %%F in (*.csv) do call jrepl "search string" "replace string" /L /F "%%F" /O -
Issue the following command from the console prompt to get full documentation:
jrepl /? | more
I configure my console window with a large buffer height so I can scroll back to see prior output, thus I don't need | more when I look at the help.

SublimeText3 - Find all files without a string?

I've looked around quite a bit for an answer to this, but I cannot seem to find what I need. Is it possible with SublimeText3 > Find in Files to do a search for all files that DO NOT include a string?
I've tried toggling the Regular Expressions button beside "Find:" and entering a value, but I'm not a regex pro, so I may be doing it wrong?
For example, I want to find all files in a designated folder that DO NOT have the following string:
social-links
Any help would be greatly appreciated.
Search for all files in your directory in question (for anything, like a space or the letter e...assuming every file has a space or letter e!), and copy all those file-paths to a new file.
Search for all files with the word, and paste that path-list into a second file.
Sort both files, then compare them to see which lines--which paths--are missing from the has-the-word file. Those are the ones you want.
As far as a single find-in-files search, I don't see how you would do that in Sublime or any other basic text editor. Here is some more information:
https://unix.stackexchange.com/questions/26836/how-can-i-find-all-files-that-do-not-contain-a-text-string
Find files that does not contain a string
How to find all files that do NOT contain specific string in windows environment Visual Studio or any other IDE?
Good luck!

Find a text in all solutions of Team Foundation 2010

I am a developer usin VS2012, I have the code in a Team Foundation 2010 (I am not the administrator of this).
I would like to find some text in all the solutions of muy own at the same time.
The "Find and Replace" tool does not help me because this finds just in one solution.
Could anyone help me? Thanks in advance!
You can't do a search on the TFS server directly. You need to check out all the code you want to look through to your local machine first.
Assuming you have done that then you can use the Find in Files option (usually CtrlShiftF) and change the search scope to use a path or folder set by clicking the ... button next to the Look in drop down.
If you're happy to use PowerShell and you have all the code files you want to search through on your local disk, you can run the following from the PowerShell ISE:
$locationToSeach = "C:\tfs\"
$pattern = "searchtext"
cd $locationToSearch
gci -recurse -include *.* | Select-String -pattern $pattern
If you want prettier formatting (e.g. for copy to Excel), pipe the above to:
Format-Table #{Name='Path'; Expression={$_.Path}; Width=150}, #{Name='Line'; Expression={$_.Line -replace '^\s+', ''}; Width=200}

Perforce P4v: How to find file with a list of file to be find?

Is there a way or command to be use to find files using a list of files to be find in a directory?
e.g.
find the following files:
text1.sql
text2.sql
text3.sql
text4.sql
text5.sql
text6.sql
Search in: c:\archive...
Not sure if this is what you are looking for, but try the following:
Search > Find File...
Enter the directory under "Search in:"
Enter the name of the file you are looking for under "Name contains:"
Click on Find.
I'm using the P4V client version 2012.1
Just putting out there that Saulo's answer is correct, however that Rev. Perforce Visual Client/NTX86/2008.2/188141 doesn't support it. So you probably need to upgrade if you don't have the menu option (as I had to).

Resources