zip -h is confusing! I just want to know how to make a .zip from a directory. kthxbi
Syntax : $zip –m filename.zip file.txt 4. -r Option: To zip a directory recursively, use the -r option with the zip command and it will recursively zips the files in a directory. This option helps you to zip all the files present in the specified directory.
If you open a terminal console in the parent directory, or used the cd command to navigate there from the command line, you should then be able to run the command on the folder. The syntax is ' zip -r <zip file name> <directory name> '. The '-r' option tells zip to include files/folders in sub-directories.
Zip files can be easily extracted in Windows, macOS, and Linux using the utilities available for all operating systems.
Select “Compressed (zipped) folder”. To place multiple files into a zip folder, select all of the files while hitting the Ctrl button. Then, right-click on one of the files, move your cursor over the “Send to” option and select “Compressed (zipped) folder”.
zip -r archive.zip dir_to_zip
from man zip
-r
--recurse-paths
Travel the directory structure recursively; for example:
zip -r foo.zip foo
or more concisely
zip -r foo foo
In this case, all the files and directories in foo are saved in a zip archive
named foo.zip,including files with names starting with ".", since the recursion
does not use the shell's file-name substitution mechanism...
Even if it functions well I would like to propose you 7z(http://www.7-zip.org/).
7za a directory.7z directory
It has a better compression and it is opensource, GNU LGPL license, freely available for windows,linux,BSD...
BTW it creates/opens 7z, XZ, BZIP2, GZIP, TAR, ZIP and WIM,
and open unpack only: ARJ, CAB, CHM, CPIO, CramFS, DEB, DMG, FAT, HFS, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, RAR, RPM, SquashFS, UDF, VHD, WIM, XAR and Z.
[They should pay me for advertisement :-)]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With