Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I would like to add the file date in a new column for each entry in the CSV file
From this:
698508.633,7226619.52,6.166
698507.105,7226620.09,6.096
To this:
698508.633,7226619.52,6.166,15-03-09
698507.105,7226620.09,6.096,15-03-09Im sure there is an easier way than manual input
Danno

You can do that using a batch script.
:: MYCSV.BAT Usage: mycsv File_Name @echo off & setlocal > output.csv set filedate=%~t1 set filedate=%filedate:~0,10% for /F "delims=" %%j in (%1) do echo.%%j,%filedate%>> output.csv del "%1" ren output.csv "%1" :: End_Of_Batch
Where File_Name must not have embedded blanks.

I created the batch file and saved it in the directory where all my csv files are, then ran the batch file and all that happened is all my files disapeared. I do have backups.
Im quite new at this, so what did i do wrong?

First of all never try a script or program without backing-up the involved data! Now have you typed
mycsv FileName.csv
as the batch processes just one file a time. If no operands are specified what you reported is possible. Please, report exactly what you typed, as I have the deal to give you the script working as you need.File names must not have spaces and the date has full four year digits, but that may be easily adapted to your format.
When the script works properly I can give you the way to process all the files in one run.

![]() |
Outlook express 6.0
|
ms office 2003
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |