1

Upfront disclaimer! I have no programming skills! But can follow clear instructions...

Using Notepad++, I would like to copy a file called "Example1" containing fresh data gathered over the previous week, from one folder, and paste it to another folder that already contains a file called "Example1", which contains historical data for many previous weeks.

Is it possible for the new file to be pasted into the new folder and the data it contains to be added to the current data, instead of just overwriting it and erasing the historical data in the current file?

I would like the new data to make new lines/rows BELOW the existing data. There may also be duplicate lines rows, is there a way to take care of this as well, or would that need to be done separately?

The end goal is to have seamless chronological data with no duplicates in .csv format, simply by copying and pasting once.. I really hope it's possible, it will save so much time!!

Thanks, SJI

| improve this question | | | | |
1

Short answer - no. (Not from within notepad++)

New lines (of data) can be added to the bottom of the files. This is done from the command line by typing something similar to:

type c:\newdata\example1.txt >> c:\historicaldata\example1.txt

The above command will add content of the C:\newdata\example1.txt into the end of C:\historicaldata\example1.txt.

Warning:
Note the use of double >> - this ensures it will ADD at the end of the file.
If you only use a single > - this will REPLACE the content of the target file.

Duplicate removal - you need to manually remove or check this site for several possible answer: https://stackoverflow.com/a/16293580 to use regex searching for duplicate line finding.

| improve this answer | | | | |
0

You can use the Run command (usually found on the main menu bar and also accessible by pressing F5) and type this in the box:

cmd /c type "$(FULL_CURRENT_PATH)"  >> "C:\test\Example1.txt"

This will run the command prompt, and the /c flag will close the window once it's completed.

The "$(FULL_CURRENT_PATH)" is a Notepad++ variable that can be used in the run dialog that represents the currently selected file (so if you're working on Example1.txt or Example2.txt it won't matter).

The >> appends the data from the current file to C:\test\Example1.txt. If you have spaces in the file path, you need to ensure it's surrounded by quotes (e.g. "C:\this path\has spaces\Example1.txt").

Hope that can help.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.