Jzip Windows from the terminal is a tool like 7-zip that allows the compression of files on Microsoft systems considering the infinite applications that can compete including those web
Jzip Windows is a software that quickly performs the compression of files and folders in Microsoft Windows operating systems as well 7-zip, but which in many cases simplifies script management even on very recent versions of the operating system.
Its installation is very fast, as the common installation is not necessary, but it is enough to copy the jzip.exe file in the c: \ Windows \ System32 \ directory and retrieve the file from the cmd.exe terminal using the permissions granted to the administrator of the system for opening the command terminal.
It is not easy to find on the network the various commands necessary for the use of this useful tool that, for those who are not a systems engineer and operates on servers, may seem almost useless in the face of the rapid "send to compressed folder" present in Microsoft systems.
System operators also often use it to write batch procedures and launch file and folder compression using the scheduler utility.
The use of the command line is as follows:
jZip <command> <archive name and extension> <path> <file to add / extract>
- The elements in [brackets] are optional.
- The options are introduced by a hyphen ["-d"] or by a bar ["/ d"].
- Multiple options must be separated by one or more spaces ("-d -n", not "-dn")
|A||Add documents to the archive||jZip -a test.zip * .txt
Add all * .txt files to the
current folder to test.zip
|-d||Deletes the files specified by the Zip file||jZip -dd: \ temp.zip license.txt
Removes the license.txt file from the temp.zip file
|-m||Move files to Zip file (files are then deleted from disk)||jZip -md: \ temp \ test.zip *. *
Move all files in the current folder to test.zip (the original files are deleted from the system)
|-s [password]||Specify a password (if no password is provided, a prompt will be generated)||jZip -spassword d: \ temp \ test.zip *. *
Add all the files in the current directory to test.zip with pasword which is "password".
|-u||Update (add new or changed files)||jZip -ud: \ temp \ test.zip *. *
Adds only new or updated files (found in the current folder) to test.zip
|-X||Exclude the files specified by the zipping process||jZip -x * .txt d: \ temp \ test.zip *. *
Create test.zip and include all the files in the current directory except the .txt files.
|-e||Extract the files from the archive||jZip -e text.zip
Extracts all files from Test.zip to the current directory.
Advanced commands and options
|-ed||Extracts all files from the archive, recreating the directory structure from the folder information stored in the Zip file.||jZip -ed text.zip|
|-and||Check the integrity of the archive file without extracting the files.||jZip -et c: \ documents \ file.zip
This command will test the integrity of the zip file c: \ documents \ file.zip
|-e||Overwrite the files without asking for confirmation.||jZip -eo c: \ documents \ docs.zip
This command extracts all the files from docs.zip and overwrites the files in the current directory, if necessary.
|-is-||Do not overwrite the files.||jZip -e- c: \ windows \ archive.zip
This command does not overwrite the files in the current directory.
|-Is||Skip older files||jZip -es c: \ documents \ letters.zip
This command extracts only the most recent files, skipping the older ones.
|-a +||Remove the archive attribute from each file after adding it to the Zip file||jZip -a + test.zip * .txt
Adds all * .txt files in the current directory to test.zip and then resets the archive attribute.
|-b [drivepath]||Use another drive for the temporary Zip file. This option allows you to use another unit for that purpose when space considerations force the problem||jZip -bd: \ temp test.zip c: \ temp \ *. txt|
|- | <d | and | b> <0-5>||Set a compression method and a level, when adding files to archive. Use [d] for Deflate, [e] for Enhanced or [b] for the Bzip2 algorithms. Use 0-5 to set the compression level. 5 = maximum compression; 0 = no compression||jZip -le5 d: \ temp \ test.zip * .gif
Adds all the .gif files in the current directory to the test.zip file, using the advanced deflate method with maximum compression.
Replace all files already included in the archive, which are newer on disk. (Note that File must have the same name, so the "freshen" command will work).
|jZip -fd: \ temp \ test.zip * .txt
Replaces all the .txt files that are currently in test.zip with the latest .txt files found in the current folder.
This command adds all the files that are not already in the Zip file to the Zip file and replaces all the files that have a newer date on the disk. (This command is the same as -a (Add), except that it skips files that are already in the Zip file and have the same date in the Zip file and on the disk)
|jZip -ud: \ temp \ test.zip *. *
Used to update existing Zip files. The above adds new files or updated files found in the current directory to test.zip. If a file currently exists in the Zip file, add it only if the date on the disk is more recent than the file date in the Zip file.
|-I[-]||Add file whose archive attribute is set. the archive attribute is then removed. (Use the optional suffix "-" to leave the archive attribute on)||jZip -id: \ temp \ test.zip * .txt
Adds all the * .txt files found in the current directory, with their archive attribute set, to test.zip. then remove the archive attribute from * .txt files.
|-wHS||Include hidden and system files in the zipping process.||jZip -whs d: \ temp \ test.zip *. *
Zip all the files in the current folder including system and hidden files.
|-wHS||Exclude hidden and system files from the zipping process (default).||jZip -Whs d: \ temp \ test.zip *. * Compresses
all files in the current directory except the system and hidden files.
|-jhrs||Do not store hidden, read-only, and system attributes in the Zip file.||jZip -a -jhrs d: \ temp \ test.zip *. *
Add all the files in the current folder, EXCEPT the hidden and system files, to test.zip. Hidden, system, and read-only attributes are not preserved on files added to the Zip file.
|-Jhrs||Store hidden, read-only, and system attributes in the Zip file (default).||jZip -a -Jhrs d: \ temp \ test.zip *. *
Add all the files in the current directory to test.zip, EXCEPT hidden and system files, in the current directory on test.zip. Keep the attribute read-only if applicable.
|-K||Do not update the file date of the zip file. (Retain the original date)||jZip -a -kd: \ temp \ test.zip *. *
Add all the files in the current folder to test.zip (existing Zip file) and keep the original file date.
|-m [f | u]||An advanced version of the "Move" basic command.
When the operation "Freshen | Update "is complete, the original files are deleted.
|jZip -mf d: \ temp \ test.zip *. *
- If the file exists in test.zip and date is more recent on disk, move the file to test.zip.
- If the file exists in test.zip and the date is earlier than or equal to disk, simply delete the file from the disk.
- If the file does not currently exist in test.zip, ignore it.jzip -mu d: \ temp \ test.zip *. * Move all files to test.zip. Those files that already existed in test.zip and are newer on disk, update those files. All new files found in the current folder are also moved to test.zip. The files on disk are deleted.
|-po -P||Stores the folder names.
A lowercase p stores only the folder names (including subfolders) using the -r option, while an uppercase P stores all the folder information specified on the command line or in the list file. (Use with the -r option). For example, we have the folder structure:
Level1 \ a
Level1 \ bLevel1 contains a file file1.txt
Level1 \ a contains two files a1.txt and a2.txt
Level1 \ b contains two files b1.txt and b2.txt
|jZip -p -rd: \ temp \ test.zip d: \ level1 \ *. *
This creates test.zip with file1.txt, folder level1 \ a and file a1.txt and a2.txt and folder level1 \ b with files b1.txt and b2.txt. (Note: the level1 folder itself is not included). When you extract test.zip, you get this structure in the extracted folder:
Levela \ a1.txt
Levela \ a2.txt
Levelb \ b1.txt
Levelb \ b2.txtjZip -P -rd: \ temp \ test .zip d: \ level1 \ *. *
This creates test.zip with level1 folder and file1.txt, folder1 \ a and files a1.txt and a2.txt and folder1 \ b layer with the files b1.txt and b2. text. When test.zip is extracted, you get this structure in the folder that you extract:
Level1 \ file1.txt
Level1 \ Levela \ a1.txt
Level1 \ Levela \ a2.txt
Level1 \ Livellob \ b1.txt
Level1 \ Livellob \ b2.txt
|-T [date]||Includes files older than the specified date. (The current date is used, if a date is not specified)||jZip -t20030902 d: \ temp \ test.zip *. *
Add all the files in the current directory to test.zip, which have an equal or more recent date than the 2003, 02 September.
The listfile command
A "listfile" is a default TXT file, which contains a list of files to extract from an archive.
A list file is based on the line, where each line can only contain a file name.
File names can also include wildcards. The wildcard specification "*" is intended as "*. * ", That is all the files.
The list file can also contain comments, indicated by a semicolon. any text that follows a semicolon (';') is ignored until the end of the line.
To use the listfile command, type the following:
jZip -e <path and filelist name> <path to extract files>
For example, we have an archive file called "MyArchive.zip".
This archive contains many files of various types such as DOC, JPG, TXT, PDF, EXE, etc. we can use the basic extraction command, "-e", to extract the files, but this will extract ALL the files from the archive. on the other hand, we can create a list file, in which we specify exactly which files we want to extract from the archive.
We create a TXT file, called "mylistfile.txt". The file contains the following lines:;
List of files to extract
* .txt; Extract all the .txt files
Then we execute the following command:
jZip -e MyArchive.zip @ mylistfile.txt c: \ temp
This command extracts only the files specified in the list file (docs, jpgs, txts) and places them in the "c: \ temp" folder. All other files are skipped and not extracted (pdf, exe, etc.)