Solved i want to add last modified date to the file while zipping

May 28, 2012 at 19:28:21
Specs: Windows 7
HI

i want to add last modified date to the file while zipping using batch file.
I am trying to zip a file which is in c:\temp\myfile.csv . I am running the below statement.

C:\WINZIP\WZZIP.EXE "c:\temp\Archive\myfile.ZIP" "c:\temp\myfile.csv"

this is zipping the file now i want to add the last modified date to this file as i would be archinving the files daily therefore want the last modified date added. Please help.

Thanks..
Smiltha


See More: i want to add last modified date to the file while zipping

Report •


#1
May 28, 2012 at 22:38:31
✔ Best Answer
:: add file mod date to csv
:: smitas.bat Tue 29-05-2012 12:29:58.29
@echo off & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('dir/b my.csv') do (
set D=%%~Ta
)
echo !D! >> my.csv
goto :eof

::====== script ends here =================


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
June 5, 2012 at 07:01:31
HI M2.
Thanks for replyon this this .

When i tried this it opend the csv file and did nothing. when i closed the csv file it just closed and did do anything.

what i am looking is

This is what i did

@echo off & setLocal enableDELAYedeXpansioN
for /f "tokens=* delims= " %%a in ('E:\Extracts_AutoUpload\SALES_ORDERS.CSV') do (
set D=%%~Ta
)
echo !D! >> SALES_ORDERS.csv
goto :eof


my file name i s: SALES_ORDERS.CSV what i wanted is to add the last modified date which is 06042012. and wanted the file to be SALES_ORDERS_06042012.CSV'

Hope u have some suggestions. thanks

Smitha


Report •

#3
June 6, 2012 at 00:26:05
Remove the single quotes ['] inside the () in the FOR loop.


=====================================
Life is too important to be taken seriously.

M2


Report •
Related Solutions


Ask Question