Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

OS: Windows XP

Requirements:

  1. Support compress/uncompress zip format
  2. Like gzip can use the original file name as archive file name, so no need to specify archive file name. gzip target_folder, so the output will be target_folder.zip.
share|improve this question

closed as off-topic by random Jan 19 at 22:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – random
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Are you looking for more of a command-line tool, or a GUI'd one? –  Isxek Mar 2 '10 at 21:33
    
gzip -c writes to stdout leaving original file untouched. Is this what you mean? –  Umber Ferrule Mar 2 '10 at 21:53
    
@Isxek - command-line tool. thanks. @Umber Ferrule - I meant 'gzip target_folder' only. –  Stan Mar 2 '10 at 22:21

2 Answers 2

up vote 3 down vote accepted

7-zip has this behavior and can compress/uncompress zip format:

alt text

As you can see the file extension has been stripped, and the rest of the file name used as the archive name.

Edit: For a command-line solution, you can still use 7-zip. Check out my script here. You can modify it like so:

#!C:/Perl/bin/perl.exe

use warnings;
use strict;

exit unless @ARGV;

my $path = "C:\\Program Files\\7-Zip\\7z.exe"; # modify this accordingly
my $infile = (split /\./,$ARGV[0])[0];

system("\"$path\" a $infile.zip @ARGV");

Just tested it on my fasm folder:

alt text

share|improve this answer

The simplest thing you could do (if you only want to compress one file or directory tree per archive) is to put one of the following lines into a batch file in your 7-Zip install directory (say zip.bat):

For a Zip archive: 7z.exe -tzip -r a %~n1.zip %1
For a 7-Zip archive: 7z.exe -r a %~n1.7z %1

And then call with: zip.bat target_folder

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.