1

I have opened many files in notepad++ window tabs. Is there any way(or any plugin) in npp to quickly delete all the open files?

I don't want to go to each tab, right click and use Move to Recycle Bin, since there are thousands of open files so I'm looking for a shortcut to delete all these open files in one shot. Could some please suggest if there is any way to do it?

11
  • 1
    “there are thousands of open files” Really?
    – Toto
    Commented Jun 5, 2020 at 11:55
  • @Toto yes, a lot of open files, I used find in files and opened all the files which matched a specific text. Now I want to delete the matched files.
    – VVK
    Commented Jun 5, 2020 at 12:10
  • 1
    The answer is as simple and clear, you can't.
    – Toto
    Commented Jun 5, 2020 at 12:18
  • 1
    @Toto You probably can, using Python Script - Plugin for Notepad++. But the OP will have to try and write his own script.
    – DavidPostill
    Commented Jun 5, 2020 at 18:24
  • 1
    @Todo Perhaps you should read the documentation then "notepad is the object for everything to do with Notepad++ itself, not the text in the document. Things like opening and saving files, selecting different tabs, converting formats, running plugin commands and so on."
    – DavidPostill
    Commented Jun 6, 2020 at 8:15

3 Answers 3

1

This is a comment not an answer, but unfortunately I don't have enough "reputation" to add comments...

My suggestion is to use another tool: Total Commander would be an excellent candidate for your task: https://www.ghisler.com/download.htm

It's so easy in TC to search for files Alt+F7 containing your specific text, just check the "Find text" field Alt+T, then when search is done select "Feed to listbox" Alt+L, and finally Select All Ctrl+A and Delete them

enter image description here

Note: if you want to preview any of your files before deletion just F3 over them and you can quickly view the content (and while viewing, keep pressing F3 to jump to all occurrences where you searched text was found)

7
  • OP didn't ask for another tool, they want to do the job with Notepad++.
    – Toto
    Commented Jun 13, 2020 at 15:51
  • 1
    Yeap, I know the question was about N++, but instead to complicate life with Python scripting the task can be achieved simpler in other ways, just my opinion: use the right tool for the task. TC is only one way (which I use) but there are many other alternatives even open source to choose alternativeto.net/software/total-commander/?platform=windows Commented Jun 13, 2020 at 16:00
  • They don't want to delete “some files” but only those that are opened in Notepad++. How do you know what are these files in Total Commander?
    – Toto
    Commented Jun 13, 2020 at 16:20
  • As the post mentions: have to repeat the same search with TC like the one which was done in N++: the results should be the same... Commented Jun 13, 2020 at 16:29
  • You're assuming there is a pattern for searching files to be delete, may be it's true, but it is not said in question. They said they have thousands files opened, they never said those files have common characteristics.
    – Toto
    Commented Jun 13, 2020 at 16:47
1

You could try to do it someway like this:

  • Make a copy of %USERPROFILE%\AppData\Roaming\Notepad++\session.xml
  • Open the copy in an advanced text editor (Notepad++ is fine too)
  • Do a regular expression search & replace to get rid of everything but the filenames
  • Add "del " to the beginning of every line
  • Save as a .bat file
  • Run the .bat file
-2

Please go to this path - C:\Users{your user name}\AppData\Roaming\Notepad++\backup and remove the files which are not needed

2
  • 1
    What question are you answering?
    – Toto
    Commented Apr 19, 2021 at 13:28
  • 1
    Please read the full question and comments before answering. Backup folder contains only the unsaved files open in Notepad++. VVK wanted to delete all existing files that are currently open in Notepad++.
    – jous
    Commented Apr 21, 2021 at 11:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .