JR.
JR.

Reputation: 6023

Combining files in Notepad++

Is there a Notepad++ plugin out there that automatically combines all currently opened files into a single file?

Update: Yes, I am very aware of copy and paste :) I'm working with lots of files, and I want a solution that makes this step in the process a little bit faster than several dozen copy and pastes.

I'm aware of utilities for combining files, but I want the convenience of combining specifically the files that are currently opened in my text editor.

If there isn't a plugin out there already, I'll write one myself; I was just wondering if it exists already to save me the time of developing one.

Upvotes: 25

Views: 106433

Answers (3)

Hendrik
Hendrik

Reputation: 291

I used the following command in DOS prompt to do the merge for me:

for %f in (*.txt) do type "%f" >> output.txt

It is fast and it works. Just ensure that all the files to be merge are in the same directory from where you execute this command.

Upvotes: 29

user3330447
user3330447

Reputation: 179

http://www.scout-soft.com/combine/

Not my app, but this plug in lets you combine all open tabs into one file.

Upvotes: 15

JR.
JR.

Reputation: 6023

I installed the Python Script plugin and wrote a simple script:

console.show()
console.clear()
files = notepad.getFiles()
notepad.new()
newfile = notepad.getCurrentFilename()
for i in range(len(files) - 1):
    console.write("Copying text from %s\n" % files[i][0])
    notepad.activateFile(files[i][0])
    text = editor.getText()
    notepad.activateFile(newfile)
    editor.appendText(text)
    editor.appendText("\n")
console.write("Combine Files operation complete.")

It looks at all the files currently opened in Notepad++ and adds them to a new file. Does exactly what I need.

Upvotes: 13

Related Questions