Working with 7-zip

Views: 11

In my previous post, link, we discussed the first part of the 7-zip “add to archive” options. In this post, working with 7-zip, we discuss the remaining options available to compress and encrypt files and folders. At the end of this post we take a look at how the compression works.

Let us continue where we left off last time.

First, let us take a look at the options available:

working with 7-zip add to archive menu

Memory usage for compressing / decompressing

This controls the amount of RAM allocated for these processes. When working with 7-zip, this impacts how efficiently it can compress files. It is also important when dealing with large files or archives. I discuss compression and decompression at the same time.

Memory usage: the maximum amount of RAM 7-Zip uses when compressing files. Higher memory usage can improve the compression ratio and speed by allowing the algorithm to handle larger data chunks and more complex data structures.
Higher memory usage: improves compression efficiency and speed, particularly for large files or archives with many files. It allows for better pattern recognition and larger dictionary sizes.
Lower memory usage: reduces the effectiveness of compression, resulting in larger archive sizes and potentially slower compression speeds, but it ensures that the system remains responsive and doesn’t run out of memory.

Split to volume, bytes

Divide a large archive into smaller, more manageable pieces, each with a specified maximum size. This is useful when you need to:

Store large files on media with size limitations (CD, DVD, USB drives).
Send large files via email or other file-sharing services that have size limits.
Upload large files to the cloud or file servers that have size restrictions.
How it works

When you specify a split size, 7-Zip creates multiple archive files (volumes), each not exceeding the specified size. All volumes have sequentially numbers. This makes it easy to reassemble them later.

Example, if you have a 5 GB file and you set the split size to 700 MB (suitable for CD-R storage), 7-Zip will create multiple volumes (approximately 7 files of 700 MB each, and 1 file with the remaining data). For 100 kilobytes use 100K, for 700 megabytes use 700M, for 4 gigabytes use 4G.

Parameters

For command-line options, to customize the compression or extraction process beyond the standard options in the user interface. For when you need more control over how 7-Zip operates.

Commonly used parameters
-m0=PPMd: use the PPMd compression method.
-mx=9: set the compression level to maximum.
-md=64m: set the dictionary size to 64 MB.
-ms=64m: set the solid block size to 64 MB.
-mmt=4: set the number of CPU threads to 4.
-mhe=on: enable header encryption.
-v700m: split the archive in volume of 700 MB each.

Example: use maximum compression with a dictionary size of 64 MB and 4 CPU threads: -mx=9 -md=64m -mmt=4

Options

In this section you can set timestamps.

timestamp menu

These checkboxes are a little mystery to me. The internet comes up with first checkbox for files only, and both first and second for files and folders. But, that same internet also says that the first checkbox is for a basic timestamp, and both for a detailed timestamp. If someone knows, please let me know.

Timestamp precision: precision of the timestamps stored in the archive. Higher precision can include finer details like milliseconds, while lower precision might only include the date and time down to seconds.
Store creation time: stores the creation time of each file in the archive. Can be useful for backup and restoration purposes.
Store last access time: stores the last access time of each file in the archive. Can be useful for forensic purposes or for applications that rely on access times.
Set archive time to latest file time: sets the timestamp of the archive file itself to that of the most recently modified file within the archive.
Do not change source files last access time: the archiving process does not alter the last access time of the source files.

Update mode

This controls how files are added to an existing archive.

update mode

Add and replace files: adds new files to the archive and replaces any existing files with the same name.
Update and add files: updates existing files in the archive if the source file is newer and add new files.
Freshen existing files: updates existing files in the archive only if the source files are newer. Does not add new files to the archive.
Synchronize files: synchronizes the archive with the source folder, so both contain the same files. Adds new files, updates existing ones, delete files from the archive that no longer exist in the source folder.

Regular backups: use “Add and replace files” to create regular backups that include all new and updated files.
Incremental backups: use “Update and add files”. This updates only newer versions of files and adds new files.
Maintain current versions: use “Freshen existing files”. This updates files in the archive with newer versions. It does not add new files to the archive.
Directory synchronization: use “Synchronize files” to ensure that an archive is an exact copy of a source folder, including removing files that no longer exist in the source.

Path mode

Determines how the paths of the files being archived are stored in the archive. This affects how the files are extracted later and where they are placed in the file system.

working with 7-zip update mode

Relative pathnames: stores the paths relative to the base folder from which the files are being archived. When you extract the files, they are placed relative to the folder you specify for extraction. When you want to maintain the folder structure relative to a specific starting point.

Example
Base folder: C:\Projects\MyProject
Files: C:\Projects\MyProject\src\file1.txt, C:\Projects\MyProject\docs\file2.txt
Stored as: src\file1.txt, docs\file2.txt

Full Pathnames: stores the full paths of the files. When you extract the files, they will be placed in the exact folder structure as they were originally. When you want to maintain the entire folder structure exactly as it is on the source system.

Example

Files: C:\Projects\MyProject\src\file1.txt, C:\Projects\MyProject\docs\file2.txt
Stored as: C:\Projects\MyProject\src\file1.txt, C:\Projects\MyProject\docs\file2.txt

No pathnames (Absolute pathnames): stores only the filenames without any folder paths. When you extract the files, they will all be placed in the root of the directory you specify for extraction, without any subfolders.

Example

Files: C:\Projects\MyProject\src\file1.txt, C:\Projects\MyProject\docs\file2.txt
Stored as: file1.txt, file2.txt

Options

When working with 7-zip, these three options control additional behaviors related to how the archive is created and how files are handled during the compression process.

Create SFX archive: stands for Create Self-Extracting Archive. This option creates an executable (.exe) archive that can extract itself without needing any additional software like 7-Zip. You can simply double-click the .exe file to extract its contents. Useful when you want to distribute compressed files to users who may not have 7-Zip or any other extraction software installed.
Compress shared folders: allows 7-Zip to access and compress files located in shared network folders. Useful when you need to compress files that are located on network drives or shared folders.
Delete files after compression: deletes the original files after they have been successfully compressed and added to the archive. The original files are moved from their original location to the archive. Useful to free up space.

Enter password

To protect your archive with a password. This ensures that the contents of the archive are encrypted and can only be accessed by someone who knows the password.

Show password

The password you enter will be visible as plain text. Allows you to see the password you are typing, which can help ensure you are entering it correctly.

Encrypt file names

Encrypts the file names in addition to the file contents. Not only the contents of the files are encrypted but also the names of the files. Without the password, someone opening the archive will not even see the names of the files inside. Provides an additional layer of security, ensures that even the names of the files remain confidential until the correct password is entered.

Encryption method

In 7-Zip, the primary encryption method available is AES-256 (Advanced Encryption Standard with 256-bit key), a symmetric encryption algorithm. It is considered very secure and is widely used in various security applications, including data encryption and secure communication. The 256-bit key length makes it highly resistant to brute-force attacks. It is a federal standard for encrypting data and is used by governments, financial institutions, and organizations requiring high-level data security.

How does it work

Open 7-zip File Manager, select the file you want to compress / encrypt, and click the + sign. You can also right click the file, locate 7-zip and select “add to archive”.

add to archive

The “add to archive” menu opens. I always select zip as the archive format. But that is a choice you have to make. Next, set a password. Get used to this, always set a password. When done, click OK at the bottom.

select type and set password

That is it, the archive is created.

show created zip file

Well, this is funny, the file size has increased. Normally I encrypt databases, and they really get smaller. So, this may not be the best example, but I leave this as it is.

Extract a file

To extract / decrypt the file, go to 7-zip File Manager, select the file to extract, and select Extract.

working with 7-zip extract file

When you select extract, a context menu opens.

You can select the folder where to extract to, enter a password if required, and select overwrite options.

Conclusion

Working with 7-zip has its advantages. In the beginning it looks a little confusing, but once you start to use it you will see that it is pretty straightforward. I use it to transport files to and from work. If I forget my bag with a USB stick in it in the bus, no problem. All files on the stick are encrypted with a long password. Good luck with that. I also use it to store older files and folders that I do not need any longer, but do not want to throw away yet. This way it takes up less space, and everything is saved together. So yes, I use it a lot.

This brings us to the end of my post on working with 7-Zip.

Do not forget to check the posts on the installation of 7-zip link and the 7-zip File Manager link.

Thank you for taking the time to read my post on working with 7-Zip.
I hope you found it enjoyable and insightful.
Stay tuned for more content that is coming soon.

If you like what you read, please consider sharing it with others who might find it helpful.

Disclaimer

All tips and methods mentioned in this blog are tested on Windows 11. Please note that results may vary on other operating systems or versions of Windows. Adapt the instructions accordingly.

Copyright

© 2024 Henny Staas/safecomputer.org. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Henny Staas/safecomputer.org with appropriate and specific direction to the original content.







Posted

in

by

Thank you for reading.