• Login
Community
  • Login

File Filtering based on content

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
filter
6 Posts 3 Posters 934 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    TheRobster
    last edited by Oct 28, 2020, 9:36 PM

    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?

    1 Reply Last reply Reply Quote 0
    • T
      TheRobster
      last edited by Oct 28, 2020, 9:44 PM

      By the way, it’s fine if I delete all files that don’t have the content that I want.

      T 1 Reply Last reply Oct 28, 2020, 10:00 PM Reply Quote 0
      • T
        Terry R
        last edited by Oct 28, 2020, 9:50 PM

        @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

        1 Reply Last reply Reply Quote 0
        • T
          Terry R @TheRobster
          last edited by Oct 28, 2020, 10:00 PM

          @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-contain

          A 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

          1 Reply Last reply Reply Quote 1
          • A
            Alan Kilborn
            last edited by Oct 28, 2020, 10:29 PM

            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 expression

            Then use Terry’s Explorer technique from above to delete files with timestamps older than “very recent”.

            1 Reply Last reply Reply Quote 3
            • T
              TheRobster
              last edited by Oct 28, 2020, 10:32 PM

              Thanks, I got what I was looking for!

              1 Reply Last reply Reply Quote 1
              3 out of 6
              • First post
                3/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors