Home » Questions » Computers [ Ask a new question ]

How to use Notepad++ to find files in a directory that do not contain string

How to use Notepad++ to find files in a directory that do not contain string

Does anyone know a quick and easy way to use Notepad++'s "find in files" (or other feature) to find files that do not contain a string?

Asked by: Guest | Views: 88
Total answers/comments: 2
Guest [Entry]

"While it is a great tool, I don't think you can do this in Notepad++.

This Python script will print out the filenames of any non-matches:

import glob
import os

def main():
DIR = '/path/to/my/dir'

path = os.path.join(DIR, ""*"")
files = glob.glob(path)

for f in files:
fh = open(f,'r')
fc = fh.read()
if ""footer.asp"" not in fc:
print ""no match found in"", f
fh.close()

if __name__ == '__main__':
main()"
Guest [Entry]

Just open up all files in tabs, then from the find menu (with a search criteria) click "Find In All Opened Documents". I regularly find this feature useful.