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.

| |

Use the -r option like so:

zip -r foo.zip foo

This will tell zip to recurse down the directory foo.

| |
  • 1
    @stefan-palleta: for unzipping it... do i just write unzip ? – abhi Sep 17 '15 at 7:35

Alternatively, you could use PowerShell v5.0+.

To zip:

Compress-Archive -LiteralPath 'C:\mypath\testfile.txt' -DestinationPath "C:\mypath\Test.zip"

To unzip:

Expand-Archive -LiteralPath "C:\mypath\Test.Zip" -DestinationPath "C:\mypath" -Force


Special thanks to @Ramhound

| |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy