Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract zip file and keep original in linux?

I want to unzip a zip archive on server and keep original zip file with is as well.

When I use unzip myFile.zip command it only adds extracted myFile but removes the original myFile.zip file. So what command should I use to keep original file with extracted file?

like image 777
Ayush Avatar asked Jan 27 '23 07:01

Ayush


1 Answers

unzip doesn't copy the archive, it only extracts files from it. To copy the archive to a directory, use cp:

unzip myFile.zip -d home/ubuntu/directoryPath
cp myFile.zip home/ubuntu/directoryPath

The original myFile.zip isn't removed, it still exists in the location you extracted the files from.

like image 120
choroba Avatar answered Jan 29 '23 19:01

choroba