How To: Compress files and folders in Windows

Compressed Files

As the years go by, storage devices get progressively more spacious as the content we consume takes up more space too. For instance, modern PC games can easily take at least 40GB of storage, something which would be completely outrageous just a few years ago. One of the ways to combat this expanding need for more storage is to compress files and folders so that they use as little space as possible. Today we will take a look at native file compression in Windows and why you should think twice before compressing everything in your PC.

Windows File Compression

When we are talking about compressed files, it is important to make a distinction between Windows File Compression tools and archived files of the .ZIP and .RAR varieties. The integrated Windows tools compress files and folders natively so you can continue using them normally as they do not behave any differently, at least not in any obvious way. Compressing files inside an archive is entirely different, even though Windows has natively supported file archives since Windows 8.1.

With that said, there are also some similarities between the different forms of compression. The most important thing to consider is that compressing a file or folders means that your system has to take additional steps in order to read and write in it, which means that most actions will be slower. Whenever you copy or move a compressed file, Windows will decompress it, copy it and then recompress it once more. This puts an obvious strain to the system though powerful PCs will be able to handle such operations with relative ease.

The best candidate files and folders for compression are the ones that you rarely access, especially ones that are not already compressed. For instance, compression is perfect for a drive that contains backups and a pretty bad idea for a program’s folder. Furthermore, many popular file types like .MP3 and .JPG are already compressed so compressing them even further is not helpful at all. You should also stay far away from system files and folders though Windows will not allow you to modify files that can prevent Windows from booting up.

The tools provided by Windows only work with drives formatted with the NTFS file system. Your PC’s hard drive is most likely in that format already but external devices like USB flash drives may be formatted with another file system like FAT32. Read our guide on how to format drives in Windows if you would like to change the file system for a drive.

Compressed files and folders have their icons altered to include two blue arrows pointing inwards, signifying the compression. This makes it extremely easy to determine which files you have altered, as you can see in the featured image.

Compressing through Properties

The easiest way to manage Windows File Compression is through a file or folder’s Properties window. Right-click on an item and select Properties to open the window. Then, click on the “Advanced” button in order to bring up additional options. Look at the bottom of the “Advanced Attributes” window and you will see an option that reads “Compress contents to save disk space”.

Compress Properties

Check this option, click on OK and you will get yet another pop-up asking you where the changes should be applied. You can choose to only compress that particular folder or compress every single item inside it. Whatever you choose, the process will take a while so wait until it finishes and then close any remaining open windows. To decompress the file/s, all you have to do is uncheck the previous option and click on OK once again.

Aside from individual files and folders, you can also use this method to compress entire drives. Open File/Windows Explorer and go to the Properties of any drive. In the bottom of the General tab you will see an option that reads “Compress this drive to save disk space”. I strongly advise against using it on system drives but feel free to compress external ones like we talked about before.

Compress Drive

Compressing through CMD

As always, the command prompt provides an alternate method that is far more powerful than the obvious one. The “compact” command is very flexible and allows you to quickly manage dozens of folders at the same time so you do not have to go through the Properties of every folder in your PC.

The syntax of the command is as follows:

compact /Parameter “Optional File Location”

The command can be as simple or as complex as you want it to be because there are multiple available parameters:

/c – Compresses the specified file or folder.

/u – Uncompresses the specified file or folder.

/s (:”FileLocation”)– Adding this parameter will apply your command to all subfolders of the specified directory or the current one if you do not add a new location.

/a – Will also display hidden files so it is not recommended unless you really know what you are doing.

/i – Allows Compact to continue even when encountering an error. The default behavior is to immediately stop the process once an issue arises.

/f – Forces compression. This should only be used if your previous attempt at compressing the file was interrupted by something like a system crash or a power failure.

/q – Will only report essential information. This is a very useful parameter when you are compressing multiple files and folders as the output will be easier to read.

Now that you are more familiar with the parameters, check out a few of the commands you can use as templates. Just substitute the file paths for your own and you can use them at any PC.

Compact /c “C:\Users\Adam\Desktop\FileCluster.txt”

Compact File

This command will simply compress the specified file and nothing else.

Compact /c /s:”C:\Users\Adam\Desktop\FileCluster”

Compact Folder

In contrast, this command will compress every single file in the specified folder.

Replacing /c with /u has the opposite effect of uncompressing the desired items.

Uncompress Folder

A command with additional parameters should look like this:

Compact /c /s:”C:\Users\Adam\Desktop\FileCluster” /i /q

Compact Folder Parameters

This one, for example, will compress the folder, ignore any errors that come up and only display information that you can read in quick glances such as whether the operation was successful or not.