Windows – Zip/unzip the directory on windows 7 cmd

command linecompressionwindows

I want to zip a directory containing many types of files and many sub-directories in it. I tried:

compact /c file

But I did not see anything. Next I found about zip/unzip command and tried:

zip file.zip file

It worked. But, there were sub-directories which have contents (in the input folder before zipping it) and now, in the zipped file, in that sub-directory, there is no content. It means during compression it did not store the contents of sub-directory.
What DOS command (only) can get me out of my problem.

Best Answer

Use the -r option like so:

zip -r foo.zip foo

This will tell zip to recurse down the directory foo.

Related Question