
Syntax: $zip –x file_name.zip file_to_be_excludedĬommand: $zip –x file_name.zip file_3.txt So you can exclude these files which are not needed using the -x option. Let say you are going to zip all the files in the present directory and want to exclude few files which are not needed. It will exclude files when we are going to create the zip. Suppose we have the files in the current directory are listed below:įile_1.txt,file_2.txt,file_3.txt,file_4.txtĪfter the execution of this command on the terminal here is the result: So this is useful in maintaining disk space, but ultimately unsafe while removing all input files. No deletions are completed until the zip has created archive without any error. If a directory becomes empty after deleting files, the respective directory is also deleted. It will move the files by making zip and delete the original files/folder. Will delete original/main files after zipping. The file5.txt file is removed from zip file 3) -m Option Suppose we have the files in the current directory are listed below:įile1.txt,file2.txt,file3.txt,file4.txt,file5.txtĪfter removing file5.txt from file_name.zip file, the files will be restored using unzip command

This option deletes the created zip file. It deletes the file from the zip archive. The file5.txt file is updated to the zip file.
