Computing.Net > Forums > Office Software > Add file date column to CSV

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Add file date column to CSV

Reply to Message Icon

Name: Dannochen
Date: March 30, 2009 at 00:43:16 Pacific
OS: Windows XP
Subcategory: General
Comment:

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-09

Im sure there is an easier way than manual input

Danno



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: March 30, 2009 at 06:39:34 Pacific
Reply:

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.

0

Response Number 2
Name: Dannochen
Date: March 30, 2009 at 07:28:41 Pacific
Reply:

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?


0

Response Number 3
Name: IVO
Date: March 30, 2009 at 13:05:04 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Outlook express 6.0 ms office 2003



Post Locked

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


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Add file date column to CSV

Can i convert ASCII to CSV files www.computing.net/answers/office/can-i-convert-ascii-to-csv-files/3577.html

macro to know the modified file date www.computing.net/answers/office/macro-to-know-the-modified-file-date/9246.html

Correcting file dates www.computing.net/answers/office/correcting-file-dates/6620.html