iSumsoft » Resources »computer » 2 Ways to Compress or Decompress Files and Folders

2 Ways to Compress/Decompress Files and Folders on Your PC

When your hard drive is out of space, but you don't want to delete some files and folders because it's probably important, your best choice is to compress files to free up space. This post will show you how to compress or decompress files and folders in Windows PC.


Way 1: To Compress or Uncompress Files with Windows File Compression

Windows File Compression is a part of the NTFS file system, it'll automatically compresses files to take up less space on the disk, when enable this feature. You can compress an individual file, and an entire folder.

Step 1: In Windows/File Explorer, right-click the folder and click Properties.

compress file with windows file compression

Step 2: In the General tab, click on the Advanced button.

click advanced button

Step 3: To check on Compress contents to save disk space box, and click on OK.

compress files' contents to save disk space

Tip: Decompressing compressed files and folders with Windows File Compression

To decompress this folder uncheck Compress contents to save disk space box.

decompress files and folders

Step 4: Click Apply button, then select to Apply changes to this folder only or Apply changes to this folder, subfolders and files, and click on OK.

apply changes to all subfolders and files

Way 2: To Compress/Uncompress Files and Folders in Command Prompt

You can select to compress or decompress files and folders via command. And you need to know the full path of that file and folder see 2 ways to get full path of files and folders.

view-the-location-of-files-and-folder

Step 1: Press Win + X keys to open a Command Prompt.

command-prompt

Step 2: Execute the following commands to compress or decompress, and press Enter key.


1. Compress a file or only a folder Command:

  • To compress a file:  compact /c "full path of file" /I /Q (see in screenshots below)
  • To compress only a folder:  compact /c "full path of folder" /I /Q

Such as, I want to decompress a text file in desktop, execute command like this:compact /c "C:\Users\emily\Desktop\file.txt" /I /Q

compress-a-file-and-folde


2. Decompress a file or only a folder:

  • To uncompress a file: compact /u "full path of file" /I /Q
  • To uncompress only a folder: compact /u "full path of folder" /I /Q

uncompress-a-filer


3. Compress a folder and its content: compact /c/s "full path of file" /I /Q

e.g. To compress New Folder and its contents: compact /c/s "C:\Users\emily\Desktop\New Folder" /I /Q

compress a folderand its contents


4. Decompress a folder and its content:  compact /u /s: "full path of folder" /i /Q

e.g. To uncompress a folder named usb, execute command: compact /u "C:\Users\emily\Desktop\usb" /i /Q

uncompress a folder and its contents

Step 3: When you have done, close Command Prompt Window.


The meaning of letters in command, you may want to know:

/c Compresses the specified files. Directories will be marked, so that files added afterward will be compressed.

/u Decompresses the specified files.

/s Perform the specified operation on files in given directory and all subdirectories.

/a Display files with the hidden or system attributes.

/I Continues performing the specified operation even after errors have occurred.

/Q Reports only the most essential information.