File Filtering based on content
-
Hi, I’m working on something that requires me to go through 5,255 files, and I want to filter out files that don’t contain specific content. Is there a plugin that allows this, or will I manually have to do it?
-
By the way, it’s fine if I delete all files that don’t have the content that I want.
-
@TheRobster said in File Filtering based on content:
I want to filter out files that don’t contain specific content.
One way to do it would be to update the time stamp on the files that contain the content, then you’d use file explorer to order by date and (re)move/delete any with the old time stamp. This occurs by using the “Find in Files” function and then adding a character to those files and then removing it again so the time stamp gets updated.
There is a post somewhere on this forum which explains it better, I’ll have a check to see if I can find it and then get back to you.
Terry
-
@TheRobster said in File Filtering based on content:
By the way, it’s fine if I delete all files that don’t have the content that I want.
Some posts which might help a re:
https://community.notepad-pls-plus.org/topic/17112/replace-in-files-based-on-a-condition?page=1
https://community.notepad-plus-plus.org/topic/12948/2-search-strings-in-a-group-of-files-with-the-search-function
https://community.notepad-plus-plus.org/topic/14870/regex-find-all-files-that-do-not-contain-some-words/12
https://community.notepad-plus-plus.org/topic/13497/regex-can-i-delete-the-content-of-files-that-doesn-t-have-some-words
https://community.notepad-plus-plus.org/topic/19134/find-files-that-don-t-containA quick look suggests the last one might be the best as it also provides a method of dealing with the files you don’t want using the result of the initial find.
Come back if you need any further assistance.
Terry
-
It seems Terry’s original idea has merit.
This is a bit onerous though:using the “Find in Files” function and then adding a character to those files and then removing it again so the time stamp gets updated.
Instead, I might be inclined to do a Replace in Files operation on your specific content, example:
Find:
\Qyour_literal_content
Repl: ${0}
Search mode: Regular expressionThen use Terry’s Explorer technique from above to delete files with timestamps older than “very recent”.
-
Thanks, I got what I was looking for!