Niche Refinery tips crunch and combine/merge csv files in seconds using a simple DOS batch file

The Niche refinery is a powerful tool made by the creators of the Keyword Academy and if you are interested in SEO then the methods found there are simple and powerful.  What I found though was that rather than just dumping tens of thousands of raw keywords and phrases into the Niche Refinery I wanted to do a little pre-sorting and trim away some of the keywords and phrases that were below the monthly target.  

If I wanted to do this though then I would have to take the zipped csv files I obtained from Google’s keyword tool and spend absolutely ages merging the csv’s before doing any work.  I wasn’t really interested in spending lots of time on this so I did a little research and came up with the following tips.

Tip #1 – Get the csv’s out of the zip files in seconds

This little tip is great for anyone who works with a lot of zip files and has sat and extracted each of them one by one. After reading this you will never do this again.

  1. Rather than opening each zip file simply highlight all of the zip files in a folder and right-click.
  2. If you have any kind of zip software on your PC then you should get an “extract here” option.
  3. Click on the “Extract here” and all of the contents of the zip files will be dumped into the same folder that the zip files were in.

I have included a slideshow below showing how to do this.

Click thumbnail to view full-size

Tip #2 – Merge the csv files in seconds

So the slow way to get all of your csv files together would be to open them all and then select all the data from each and copy them into a new csv or excel document…

…one by one…

Instead you can simply use a DOS command to merge them all together! To save you doing some more complicated DOS work I have put together a simple batch file. To use the batch file just follow the net set of instructions. If you want to do the more complicated DOS work then check out the next section.

The Batch File

  1. To use this batch file open a text document on your computer and name it “CSV merger” or something along those lines.
  2. Close the document and rename the file “CSV merger.bat”
  3. This will probably generate a warning from your computer that changing a file extension will make it unstable and in some cases it will. But not this time!
  4. Now right click on your CSV Merger and choose to edit it. This will open it as a text file
  5. Now paste the following code into the file and then save and close
  6. To use this batch file open a text document on your computer and name it “CSV merger” or something along those lines.
  7. Close the document and rename the file “CSV merger.bat”
  8. This will probably generate a warning from your computer that changing a file extension will make it unstable and in some cases it will. But not this time!
  9. Now right click on your CSV Merger and choose to edit it. This will open it as a text file
  10. Now paste the following code into the file and then save and close:

ECHO OFF
:MENU
CLS
ECHO V1.0 Mark Barnes, www.BunduBrain.com
ECHO .
ECHO ...................................................
ECHO .. PLEASE CHOOSE AN OPTION FROM THE MENU ..
ECHO ...................................................
ECHO.
ECHO 1 - Merge all .csv files in a folder
ECHO.
ECHO x - EXIT
ECHO.
ECHO ...................................................
ECHO.
SET /P M= Type your choice and then press ENTER:% 
IF %M%==1 GOTO MERGE
IF %M%==x GOTO EOF
GOTO MENU

:MERGE
CLS
ECHO.
ECHO ...................................................
ECHO .. Please enter the drive letter for the drive ..
ECHO .. the csv's are on e.g "C" for C:\ ..
ECHO ...................................................
ECHO.
SET /P DLETTER= Drive Letter:% 
ECHO.
ECHO ...................................................
ECHO .. Please enter the path of the folder the csv ..
ECHO .. files are located in e.g Zip\Zip Test ..
ECHO ...................................................
ECHO.
SET /P LOCATION= Folder Path:% 
ECHO.
ECHO ...................................................
ECHO .. Please choose a name for the merged csv ..
ECHO ...................................................
ECHO.
SET /P MERGED= Name of Output File:% 
CLS
ECHO.
@echo off
cd %DLETTER%:\%LOCATION%
copy *.csv %MERGED%.csv
GOTO CHOOSE


:CHOOSE
ECHO.
ECHO ...................................................
ECHO .. Type m to return to the menu, or x to exit ..
ECHO ...................................................
ECHO.
SET /P M= Please Choose:% 
IF %M%==m GOTO MENU
IF %M%==M GOTO MENU
IF %M%==x GOTO EOF
IF %M%==X GOTO EOF
GOTO CHOOSE

Doing the DOS work yourself

Okay so if you want to know how to do this using DOS then this section is for you.

  1. Start by copying all the csv files to a folder on the root of your hard drive. The reason for this is later on you won’t have to enter a long file path!
  2. Now open your “Run” file to access the DOS window. You can do this on an XP system by choosing “Run” from the start menu. On Vista and Windows 7 you should be able to just search for “Run”
  3. Once the DOS window is open you need to move to the folder where your csv files are stored. To do this you will use the “CD” (Choose Directory) function. For the purposes of this example I have moved all of my csv files into the folder c:\Zip.
  4. So to change to that folder I would enter “cd c:\Zip” (without the quotes!)
  5. Now simply enter the following: copy *.csv merged.csv
  6. This will take any csv file in this folder and merge it into a file name “merged.csv”. It will leave all of the originals intact

More by this Author


Comments 1 comment

ilmdamaily profile image

ilmdamaily 6 years ago from A forgotten corner of a dying empire. OK, it's Australia :-)

This is an incredibly useful tip - thanks mate! Was just contemplating ways to streamline this part of the process with Niche Refinery, and this has saved me having to outsource any of that process.

More money for me:-)

Keep it up!

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working