Unzip a .zip file to a specific directory using jar command

63 views Asked by At

How to unzip a .zip file to a specific directory using jar command in command prompt?

Eg. I have a zip file as stackover.zip. Now I want to extract the files inside the zip file using jar command. The files should be extracted to main1\overflow.

I tried executing jar stackover.zip -C main1\overflow

1

There are 1 answers

3
Anu Shibin Joseph Raj On

The jar utility does not have the provision to specify a target directory.

Alternatively, you can cd into the folder where you want to extract the files and then execute the jar command from there. For example:

cd ./main1/overflow
jar xf ../../stackover.zip