Question : I have a folder that will have lots of files in them i want to backup *.bak and *.txt files into a zip file using winzip and then name the zip ETC-DD-MM-YYY

Hi,

I have a folder that will have lots of files in them i want to backup *.bak and *.txt files into a zip file using winzip and then name the zip ETC-DD-MM-YYY

I will use this on daily basis as a scheduled task. So when run check the path for the ext . Copy them and zip them and save to another path.

REgards
Sharath

Answer : I have a folder that will have lots of files in them i want to backup *.bak and *.txt files into a zip file using winzip and then name the zip ETC-DD-MM-YYY

this is the code for 7zip. Not sure what the commandline for winzip 9 is, maybe somebody else can help here. However if you want to use winzip you just need to modify the last line.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
@echo off
set yourfolderpath=c:\whatever
set zipbasepath=c:\temp
:: format date string (expecting %date% to be like "Wed 06/30/2010")
set datestr=%date:/=-%
set datestr=%datestr:~4%
:: format time string (expecting %time% to be like "22:00:12.96")
set timestr=%time::=%
set timestr=%timestr:~,-3%
set datetimestr=%datestr% %timestr%
set filename=ETC-%datestr%.zip
set zippath=%zipbasepath%\%datetimestr%
if not exist "%zippath%" mkdir "%zippath%"
echo zipping *.txt and *.bak from "%yourfolderpath%\" into "%zippath%\%filename%"
::7zip commandline
7za.exe a "%zippath%\%filename%" "%yourfolderpath%\*.txt" "%yourfolderpath%\*.bak"
Random Solutions  
 
programming4us programming4us