Posts

Showing posts from October, 2011

CMD Print DIR to text file

dir > print.txt The ">" symbol is telling to put the output of the command to whatever is next. In this case "print.txt". This is useful for writing any output to a file in a script or whatever. Example: dir > %USERPROFILE%\Desktop\print.txt This example will print the directory listing to print.txt on your desktop. Other flags: dir /b file names only dir /s include all sub folders & files Original source:  http://www.computerhope.com/issues/ch000772.htm Actually I really like that site, and spent some time taking their quiz. Entertaining.

CMD combine CSV files into one

Image
I had the need to combine several CSV (excel) files into one file. The set was long enough that even opening them and copy/pasting would take over an hour. This little trick will do it in a few seconds. (in windows) 1. Put all of your files in the same folder. They all need to be CSV format and should be the only CSV files in the folder. You may want to remove headers from your spreadsheets if you don't want them later. 2. Open a command prompt. Windows+R > cmd This should be the normal command prompt because it doesn't work in powershell. 3. Navigate to the folder with your .csv files 4. type " copy *.csv newfilename.csv " 5. A new file named "newfilename.csv" will show up in the same folder. If you wanted to copy it somewhere else you could run copy *.csv path\newfilename.csv. Example: copy *.csv  %USERPROFILE%\Desktop\newfile.csv This will copy all the CSV files from the folder you are in to a file on your desktop named newfile.csv