• Login
Community
  • Login

Delete all

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
10 Posts 4 Posters 2.6k 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.
  • M
    MR.Chauhan
    last edited by MR.Chauhan Jun 5, 2020, 10:22 AM Jun 5, 2020, 10:19 AM

    Hello
    is it possible to delete all currently opened files or search result files ?

    I have approx 1000 files and nearly 250 files have no use as are dummy files, how can i delete all files which have “dummy” word inside file ?

    there is an option to open all files from previous search but can’t see any option for mass delete
    have to delete files 1 by 1 from search results using “move to recycle menu” option :/

    E A 2 Replies Last reply Jun 5, 2020, 11:34 AM Reply Quote 0
    • E
      Ekopalypse @MR.Chauhan
      last edited by Jun 5, 2020, 11:34 AM

      @MR-Chauhan

      from npp natively? I don’t think so.
      But a script, iterating of the opened buffers and searching for dummy
      might be able to do so, if you can install a plugin like PythonScript for example.

      1 Reply Last reply Reply Quote 0
      • A
        Alan Kilborn @MR.Chauhan
        last edited by Jun 5, 2020, 11:43 AM

        @MR-Chauhan

        If I needed to do this, I’d copy all of the text in the Find result window into a new tab and then do search+replace on it to leave only the pathnames of the files to delete. I’d then do another search+replace to add del (there’s a trailing space there) at the front of each line. I’d save the tab as a .bat file. Then I’d close Notepad++ and find the .bat file on my system and execute it. If I then reopen N++, all of the tabs that were for the deleted files will not be there.

        This is kind of a dangerous thing, though. You should make a backup of all of the files first no matter what method you end up going with.

        1 Reply Last reply Reply Quote 1
        • G
          guy038
          last edited by guy038 Jun 5, 2020, 1:47 PM Jun 5, 2020, 12:25 PM

          Hello, @mr-chauhan, @ekopalypse, @alan-kilborn and All,

          I’m just developping the @alan-kilborn method ! Here is the road map :

          • Open the Fin in Files dialog ( Ctrl + Shifft + F )

          • SEARCH : The literal dummy word, ( or a regex to catch all forms ! ), related to all your files which are to be deleted

          • Click on the Find All button

          => You get the Find result panel


          • Left-click on an empty location of this Find result panel

          • Select all text, with Ctrl + A

          • Copy the selection in the clipboard ( Ctrl + C )

          • Open a new tab ( Ctrl + N )

          • Paste the clipboard’s contents ( Ctrl+ V )

          • Open the Replace dialog ( Ctrl + H )

          SEARCH (?-is)^(\H.+)|^(?!\x20\x20\u:\\).+\R|^\x20\x20(.+)\x20\(\d+\x20.+\)$

          REPLACE (?1@echo OFF\r\n)(?2del /p "\2")

          • Tick the Wrap around option

          • Select the Regular expression search mode

          • Click on the Replace All button

          => You get a batch text, with as many lines del /p "xxxxxx.txt" as your total of files

          • Save this file as, for instance, Test.bat

          • Open a CMD prompt window

          • Go to the location of your batch file Test.bat

          • Run it and hit the Y key for each file deletion confirmation !

          Voila ;-))

          Best Regards,

          guy038

          A 1 Reply Last reply Jun 5, 2020, 12:31 PM Reply Quote 1
          • A
            Alan Kilborn @guy038
            last edited by Alan Kilborn Jun 5, 2020, 12:32 PM Jun 5, 2020, 12:31 PM

            @guy038 said:

            SEARCH (?-is)^(Search)\x20…

            Well, as part of my still ongoing investigation regarding THIS, I discovered that the text in the Find result window is now language-translated! So, just a note here that “Search” provided in the solution may not always be “Search” for a user.

            No mention of the Find result window text being translatable in the change list for 7.8.7. Hmmm…

            Also, again, cannot stress enough to the OP to backup the fileset first!

            1 Reply Last reply Reply Quote 1
            • G
              guy038
              last edited by guy038 Jun 5, 2020, 12:50 PM Jun 5, 2020, 12:49 PM

              Hi, @mr-chauhan, @ekopalypse, @alan-kilborn and All,

              Alan, I did not notice, in Notepad++v7.8.7, your points :

              • The English word Search has not been replaced with the French word Recherche, yet

              • Search of an single occurrence in one file only displays the right spelling !?

              a0fb5698-86dc-4fad-86d4-cf85192883be-image.png

              Cheers,

              guy038

              A 1 Reply Last reply Jun 5, 2020, 1:01 PM Reply Quote 1
              • A
                Alan Kilborn @guy038
                last edited by Jun 5, 2020, 1:01 PM

                @guy038

                So I merged my existing english_customizable.xml with the changes from 7.8.7’s.
                I did this as I usually do when upgrading, without paying too much attention to what the “new stuff” is; the important point is to not let my customized version of the file get too far “behind”.

                Going back to it after noticing the pluralization I noticed these new translation strings near the end:

                <find-result-caption value="Find result"/>
                <find-result-title value="Search"/>
                <find-result-title-info value="($INT_REPLACE1$ hits in $INT_REPLACE2$ files of $INT_REPLACE3$ searched)"/>
                <find-result-title-info-extra value=" - Line Filter Mode: only display the filtered results"/>
                <find-result-hits value="($INT_REPLACE$ hits)"/>
                

                This seems to be the root of the pluralization even for non-plural data.

                So my main point for the current thread is that in your solution you used the text Search, and this text may not be constant anymore. It will be controlled by:

                <find-result-title value="Search"/>
                

                The English word Search has not been replaced with the French word Recherche, yet

                I’m at a loss to explain this, as french.xml (for 7.8.7) seems to have the translations:

                <find-result-caption value="Résultats de recherche"/>
                <find-result-title value="Rechercher"/>
                <find-result-title-info value="($INT_REPLACE1$ résultats dans $INT_REPLACE2$ documents depuis $INT_REPLACE3$ documents recherchés)"/>
                <find-result-title-info-extra value=" - Mode de filtre de ligne : affiche uniquement les résultats filtrés"/>
                <find-result-hits value="($INT_REPLACE$ résultats)"/>
                

                So I guess in the end it is just a minor annoyance. Calling it 1 hits instead of 1 hit isn’t going to make me go demand that the developers change it back or even worse:
                Have a Preference setting for it. <----- That’s a big joke, meant for people that want everything to be Preference configurable.

                1 Reply Last reply Reply Quote 1
                • G
                  guy038
                  last edited by Jun 5, 2020, 1:18 PM

                  Hi, @alan-kilborn and All,

                  Oh…, I’m terribly sorry and confused for wasting your time ! Indeed, I got used, all these years, to using Notepad++ with its default language ( American-English )

                  So, I never use the Settings > Preferences... > General > Localization setting. I think it’s easier to respond to users by sticking to default language ;-))

                  Cheers,

                  guy038

                  A 1 Reply Last reply Jun 5, 2020, 1:26 PM Reply Quote 0
                  • A
                    Alan Kilborn @guy038
                    last edited by Alan Kilborn Jun 5, 2020, 1:27 PM Jun 5, 2020, 1:26 PM

                    @guy038 said in Delete all:

                    I’m terribly sorry and confused for wasting your time

                    Not at all!

                    I think it’s easier to respond to users by sticking to default language

                    Yes, agree.
                    But now we have to remember, that when providing solutions that use possibly translated text, that a user may not be using English.
                    But I suppose this type of situation is fairly rare.
                    But this “delete all” situation could be one of those (well, much more likely once 7.8.7 and beyond are wide-spread).

                    1 Reply Last reply Reply Quote 1
                    • G
                      guy038
                      last edited by guy038 Jun 5, 2020, 1:50 PM Jun 5, 2020, 1:40 PM

                      Hi, @alan-kilborn and All,

                      So, in order to take in account possible translations of the first line of a Find result search, I change my previous regex from :

                      SEARCH (?-is)^(Search)\x20"|^(?!\x20\x20\u:\\).+\R|\x20\x20(.+)\x20\(\d+\x20hits?\)$

                      To :

                      SEARCH (?-is)^(\H.+)|^(?!\x20\x20\u:\\).+\R|^\x20\x20(.+)\x20\(\d+\x20.+\)$

                      And I updated my previous post, of course !

                      BR

                      guy038

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