Technology in terms you understand. Sign up for my weekly newsletter, "Confident Computing", for more solutions you can use to make your life easier. Click here.

How Do I Decompress All the Files that Windows Compressed for Me?

//
A long time ago when I used the Windows Disk Cleanup tool, it compressed old files. Is there a program to decompress all files on my PC that have been compressed?

There is indeed a program that will do that.

It’s called Microsoft Windows. (Smile)

You don’t need to get any additional programs to decompress the files on your system; you can do it right from within Windows.

Become a Patron of Ask Leo! and go ad-free!


Summary

  • Windows no longer offers to compress old files, though compression remains available.
  • Decompressing files is done in Windows File Explorer.
  • There’s also a command-line approach to compressing and decompressing files.

Compressed files

File compression uses various algorithms to reduce the physical space taken up by a file without loss of any information.

Once upon a time, Windows would offer to compress “old” files as part of the disk cleanup tool. That’s no longer present in current versions of Windows. However, file compression is still supported. You may find yourself with compressed files if you’ve updated systems from older versions of Windows, or if you manually enabled compression at some point in the past.

Here’s how a folder that has been compressed is displayed in Windows File Explorer.

Compressed Example Folder
Compressed example folder.

You can tell it’s compressed by Windows because the folder name is displayed in blue instead of black.

If we look inside that folder, we see that all the files are compressed as well.

Compressed Files
Compressed files.

Once again, all of the filenames are in blue, indicating compression.

Decompressing using Windows File Explorer

Before you decompress files, make sure you have enough free space available — the files will take up more room when they are not compressed. If there’s not enough room, decompressing will fail.

Right-click on the compressed folder, click on Properties, and then click on Advanced.

Advanced Attributes on a Folder
Advanced Attributes on a folder.

As you can see, “Compress contents to save disk space” is checked.

Uncheck that and click OK. This will return you to the basic properties for the folder. Click OK here as well and you’ll be presented with one more option.

Confirm Attribute Change
Confirm Attribute Changes dialog.

You can uncompress just the folder and not its contents. Any new files placed in the folder will not be compressed automatically.

However, you can also uncompress everything — the folder and everything inside of it — by selecting “Apply changes to this folder, subfolders and files”. Do that and click OK.

Depending on the size of the folder and its contents, this operation can take some time. Once complete, the folder and everything within it will no longer be compressed.

The only problem with this approach is that you need to operate on a compressed folder to uncompress it and its contents. If a folder itself is not compressed, but contains many compressed files, you have to multi-select the individual files to perform the operation above.

If you’re not afraid of the command line, however, there is an easier way.

The Compact command

The command-line utility Compact is used to control Windows File Compression. Run “compact /?” in a Windows Command Prompt to see a list of its options.

In that Windows Command Prompt, change directory (CD) to the folder that contains the compressed folder (C:\t in my example) and run “compact /s”.

Compact /s
Compact with the /S option.

The “/s” option to compact means operate on all sub-directories as well.

The output shows that in my folder “C:\t”, which is not compressed, is the folder “Example Folder”, which is. In it are several files which are also compressed.

Worth noting is that the Compact command shows the effects of compression and the space saved for each file. Files which are already compressed (like the .jpg files) or files which are already fairly small (like the .doc files) do not benefit from additional compression. Other files, like the .exe file in this example, benefit to varying degrees based on their contents.

Uncompressing using Compact

To uncompress the folder and its contents, simply enter the command “compact /s /u”:

  • /s to operate on all sub-directories
  • /u to uncompress
Uncompressing files in the command line
Uncompressing files in the command line.

A couple of interesting points to note here:

  • Compact, by default, operates on the current directory. Because we were “in” C:\t, it tried to uncompress it. Because it was not compressed, nothing needed to be done. Because we specified the “/s” option, it then went on to operate on the contents of the folder.
  • Once again, the uncompressing operation took a little time, but each file was listed as it uncompressed.

Scaling up

You may not know where all of your compressed files are. No problem: just run Compact on the entire hard disk.

Decompressing the entire hard drive
Decompressing the entire hard drive.

Note that:

  • You’ll need to run “as” administrator, so this was done within an administrative command prompt.
  • There will be errors, as not all files and folders may be accessible. The “/i” switch instructs Compact to ignore errors and proceed anyway.

This should work just fine, but massive operations like this always make me nervous, so I’d strongly suggest backing up completely first and double-checking that you have lots of free space for the files to uncompress into.

Compression: is it useful?

I am not a fan of the built-in Windows disk compression. The technology is sound, but its usefulness has declined over time.

Hard disks are huge and relatively inexpensive these days. Even on older machines, it’s often more effective to add or replace hard disks that it is to enable compression. Particularly on those older machines, compression and decompression take additional CPU resources that could adversely impact your overall performance.

The other thing that’s changed since file system compression was introduced are the files themselves. Many files are compressed already — in fact, many of the very files you might find taking up much of your hard disk space are.

All of your music files (mp3 and other formats), video files (mp4, mov, wmv, and more), and even the latest formats used by Microsoft Office, such as .docx, .xlsx, and similar are already compressed. File system compression will not compress them by much more; in some cases, it can even make them take up a little more space

These days, I advise against using Windows File compression unless you really have no other options.

Podcast audio

Play

Video Narration

Footnotes & references

1: If you look closely, you’ll see that the compression ratio is very, very small. This is due to the fact that some files are themselves small and that others are already compressed (the jpg file format is a compressed format).

10 comments on “How Do I Decompress All the Files that Windows Compressed for Me?”

  1. Well, if time is not an issue and you feel lazy, one way of uncompressing multiple files in a noncompressed folder – easily, is first compress the folder, then uncompress it applying changes to subfolders and files. That only takes two steps instead of having to select all the compressed files.

  2. Am I wrong in the assumption that a compressed Windows file will automatically be decompressed on its next use? The reason I ask is why bother manually decompressing files if Windows needs to do it to run the file?

    The file is decompressed in order to be used, but it remains compressed on disk unless you manually specify it should no longer be compressed.

    Leo
    05-May-2012
  3. To both Leo and Smiling Carcass (what a weird handle, BTW!) —

    Yes, Windows does indeed, completely transparently, decompress and then recompress, any compressed file that is called up for use.

    For example, if you have a compressed textfile — “C:Example.TXT”, for example.txt (hehehe) — and you double-click on it, it will open right up in your default text editor (usually, but not always, Windows Notepad). If you alter the file and re-save it, the new version will automatically get recompressed as soon as you close the file. It works really well, and on systems with fast processing speed, compression shouldn’t create any noticeable delay at all unless the file in question is either really huge, the compression involves manipulations of great complexity and massive calculations, or both.

    Leo‘s issues with files already compressed  are perfectly valid. Folders containing MP3 and movie files should not  be compressed; the same goes for folders containing JPG’s and GIF’s. These files will not benefit from compression because they are compressed already, and actually stand a good chance of being made larger  than they were to start with!

    On the other hand, BMP and WAV files can  and should  be compressed, because these are both uncompressed file formats that are both typically very large (the former a picture file format, the latter a soundfile).

    Two other things to note about Windows compression. First, it isn’t very efficient. It’s based on an older “zip” standard, which has since been superceded. And second, it’s not encryption-compatible — that is, you can’t “compress” AND “encrypt” your files (in Windows) at the same time; you can do one or the other, but not both — it an “exclusive or” choice. If you want to encrypt the files you compress, you must use a third-party utility to encrypt it, then mark it for compression (which is useless, since encrypted files don’t compress).

    Good third-party encryption tools, however, have their own compression algorithms and will compress your file before  encrypting it, which not only makes the file smaller but actually improves the security of the encryption. WinZip in particular is famous for this, and is highly regarded. It uses the AES encryption algorithm, and a heavy-duty compression. It should scarcely need saying that such files — being already compressed — should never  be placed within a compressed folder, or otherwise marked for compression by Windows.

  4. Thanks for the response, Leo and Glenn P. So, compressing a lot of files, especially on a less powerful PC could have performance consequences.

    I was aware Windows would need to decrompress a file to load it into memory and use it; I was not aware it would leave the saved file compressed on disc. but thinking logically, it is really pretty obvious now what happens.

  5. “These days, the bottom line is that I advise against letting the clean up utility compress files in the first place unless you really have no other options.”
    Leo, I would like to take your advice since I have 400MB of a 500MB disk free. But you failed to say how to turn off the compress option.

  6. Leo, you wrote:

    “If a folder itself is not compressed, but contains many compressed files, you have to multi-select the individual files to perform the operation above.”

    I do believe that if you do an Edit – Select All and then right-click on the files and select Properties, you’ll be presented with a dialog with a checkbox for compression. Clear it (if only some files are compressed, this may require more than one click) and then click Apply. App

  7. I have been totally blind (no light/color/shadow perception), since birth. I use a screen reader for computer access. Personally, I’ve never used Windows compression, either.

    Anyway, my question is about PNGs, GIFs and other compressed image file formats. It has to do with their usability as a sighted person. Wouldn’t you have to resize the picture with your mouse/touch pad/scroll bar every time you wanted to view it? Since it’s a compressed image, I figure it would be more squishy and narrower than all the other pictures you may have. And a GIF or PNG would automatically narrow and squish back on its pixels (because it’s a raster) whenever you tried to close it. So you would have to enlarge it so much the picture would become blurry because the pixels were so big. Is this picture in my mind true? And if it is, how come they’re so common if they have to be re-widened all the time for easier viewing? Any insight would be appreciated.

    • Compression doesn’t refer to compressing the size of the image. It compresses only the size of the image file, for example, by combining duplicated bits and removing less significant data from the file.

  8. Thanks so much to everyone who posted advice. It turns out the answer is simple as was suggested, since I started compressing the disk with windows all I had to do was use windows with compress unchecked and the problem was solved. I feel a little embarrassed that I bothered everyone with this since I think I should have figured it out myself, however I didn’t and very much appreciate the help.

  9. Just for the record… You have it backwards.

    Small files are what get “compacted”, not large files. This is NOT “Zip compression”, this is lossless “Sector compaction”. EG, a file that normally consumes only 30 bytes, is fit into a “sector” that is 4096 bytes large. On the disk, it consumes 4096 bytes, not only 30 bytes.

    Compacting, involves taking all the small files which don’t fill-up a whole “sector”, and packs them into groups that WILL consume a whole sector. Thus, a sector of 4096 bytes will now contain 20 files which were only 200 bytes each. (Like shortcuts, ini files and other useless small files.) Previously, those 20 files would have consumed 20×4096=81,920 bytes on your hard drive, but now they all fit into one individual, compacted, sector.

    There is a separate “index”, for those file chunks, which now require a sector-ID and a sub-sector-ID, for the files to be found. There is no actual “compression”, as the data is still raw and readable in the original form. Unlike windows “compressed folders”, which are just zip-files, which windows can read like a “folder”. Those contents are “zipped-up”, using actual “data compression”. (That uses a dictionary and index of “symbols”, to represent data-bits, which have to be “decompressed”, before the data can be read as raw data again.)

    Thus, large files will see little gain, as they consume whole sectors, and only the ends of the files, which don’t fit into a whole sector, will become “compacted”, into one of those shared sectors, if it can fit into one.

    Windows could solve this problem if hard-drives were just setup to use isolated sector-sizes, which can be resized, as needed. Stuff small files into small sector partitions and large files into large sector partitions. Poof, instant problems solved… You can now manage drives that are millions of terabytes large, without having to force all users to use only one large, inappropriate, sector size. (They do that because there are only so many bits that a directory can use, to seek to specific locations fast. Currently, it uses 4096 or 4KB, unless you specify otherwise, on an NTFS, FAT16, FAT32 and exFAT formatted disk.)

    P.S. Archives often use sectors of 256KB per sector, because the “images”, are all large files, often exactly in chunks of 256KB, or in multiples of 256KB per chunk. The files are pre-allocated to be zero-padded, since space isn’t needed between files on disk-images.

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.