views:

216

answers:

1

I have a script set up to rotate some log files in windows, and as part of the process I'd like it to automatically compress the rotated file. To do this I use the command

compress source.file destination.file.zip

However, if I try to open the file, I get the message "The Compressed (zipped) Folder is invalid or corrupted"

I've tried compress with -Z, and I get the same message. What am I doing wrong?

A: 

compress output is not ZIP file format compatible, it uses the LZW algorithm.

The only way to "open" a compressed file is with uncompress or gunzip.

Windows ports of common Unix commands, including compress and gzip/gunzip available here.

EDIT: To produce ZIP files from the command line in Windows, you can use something like 7-Zip, which includes a command line application (7z.exe). The Unix commands linked above also include zip.exe for manipulating ZIP files from the command line.

Grant Wagner
The compress command does not do the same thing as the "send to: compressed (zipped) folder"? Is there a windows command that will do that?
JoBu1324
@JuBu1324: No, the `compress` command (not sure where you even got it, Windows does not come with one) does not do the same thing as placing a file in a "compressed (zipped) folder" (which is just a `.zip` file). Download something like 7-zip (http://www.7-zip.org/) which includes a command line version (7z.exe) to produce ZIP files.
Grant Wagner
This isn't really the answer I was looking for, but since I like the unix option and it doesn't require any installation (which is important on for our servers right now), I'm going to mark this as the answer.
JoBu1324