Helping people with computers... one answer at a time.

The Windows disk cleanup utility has an option to compress files that aren't used often. Windows also includes the tools needed to uncompress them.

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

What I mean is that you don't need to download or get any additional programs to decompress the files on your system; you can do it right from within Windows.

Compressed files

Here's a folder that has been compressed, displayed in Windows Explorer:

A compressed folder in Windows Explorer

You can tell it's compressed because its name is displayed in blue instead of black.

If we look inside that folder, we can see that all of the files are compressed as well:

Compressed files in Windows Explorer

Once again, all of the filenames are in blue, indicating that they are compressed.

Decompressing using Windows 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 to handle that, then the operation will fail.

Right-click on the compressed folder, click on Properties, and click on Advanced:

Advanced Properties for a Compressed Folder

As you can see, the 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.

Confirmation of an uncompress operation

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 - right now 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 a while. Once complete, the folder and everything within it are no longer compressed.

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

If you're not afraid of the command line, however, there's 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 to the directory (aka folder) that contains the compressed folder and run "compact /s":

C:\Users\LeoN>cd \t

C:\t>compact /s

 Listing C:\t\
 New files added to this directory will not be compressed.

        0 : 0 = 1.0 to 1 C Example Folder

 Listing C:\t\Example Folder\
 New files added to this directory will be compressed.

  6844602 : 6844416 = 1.0 to 1 C 02 - Stronger (What Doesn't Kill You).mp3
 31681228 : 29511680 = 1.1 to 1 C example.pptx
    52810 : 32768 = 1.6 to 1 C maintaining_windows_7.html
  1546621 : 1392640 = 1.1 to 1 C QuickStartGuide.pdf

Of 5 files within 2 directories
5 are compressed and 0 are not compressed.
40,125,261 total bytes of data are stored in 37,781,504 bytes.
The compression ratio is 1.1 to 1.

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 .mp3 files - do not benefit from additional compression. Files which are basically text - such as .html files - do. Other files 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, and "/u" to uncompress:

C:\t>compact /s /u

 Setting the directory C:\t\ not to compress new files [OK]

 Uncompressing files in C:\t\

Example Folder [OK]

 Uncompressing files in C:\t\Example Folder\

02 - Stronger (What Doesn't Kill You).mp3 [OK]
example.pptx [OK]
maintaining_windows_7.html [OK]
QuickStartGuide.pdf [OK]

6 files within 3 directories were uncompressed.

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

After Windows disk cleanup has compressed files, it's often not clear where all of those compressed files are. Therefore, it is quite possible to consider the following:

C:\Users\LeoN>cd \
C:\>compact /s /u

In other words, change directory to the root of the C: drive and then uncompress everything on it. (You may need to run the Windows Command Prompt "As Administrator" to perform this operation.)

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

Compression: Is it useful?

I am not a fan of Windows built-in 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 that you might find taking up much of your hard disk space are.

All of your music files (mp3 and other formats), video files (m4p, mov, wmv and more), and even the latest formats used by Microsoft Office, such as .docx, .xlsx, and similar are all 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, 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.

Article C5290 - May 3, 2012 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

May 4, 2012 8:18 AM

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.

Smiling Carcass
May 4, 2012 6:48 PM

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.
Glenn P.
May 5, 2012 9:08 AM

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.

Smiling Carcass
May 5, 2012 8:20 PM

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.

Ken in San Jose
May 6, 2012 3:00 AM

"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.

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.