3

I think the header explain the question. I want to do inside a bat-file:

zip /a /m myfile.log myarchive.zip

where I just invented the zip comand and the options: /a add file /m Move file

It is run on Windows Server 2003.

berocoder
  • 197
  • 2
  • 9

2 Answers2

4

you need to use an actual implementation of a zip program. take a look at gzip, bzip or 7zip. Each program will have different command line switches

Nick Kavadias
  • 10,796
  • 7
  • 37
  • 47
2

I've used 7-Zip in batch files, this line for example compresses all *.bak files in a given folder:

FOR /f %%i in ('DIR /b D:\Backup\*.bak') DO "C:\Program Files\7-Zip\7z.exe" a -tbzip2 -mx3 D:\BackupCompressed\%%i.7z D:\Backup\SQLDaily\%%i

You have to download the right version of 7-Zip for your operating system (32 or 64 bit and use the 7z.exe).

Here is the link to a page with command line examples.

splattne
  • 28,508
  • 20
  • 98
  • 148