Skip navigation

JSI Tip 0316 - Command line NTFS compression.

Compact is a native Windows NT command that displays or alters the compression state of files and directories. The syntax is:

compact \[/c\] \[/u\] \[/s\[:DirName\]\] \[/i\] \[/f\] \[/a\] \[/q\] filename \[...\]

If run without any parameters, it displays the compression state of the current directory.

 Parameter     M e a n i n g
 /c  Compresses the specified directory or file.
 /u  Uncompresses the specified directory or file. 
 /s\[:\DirName\]   applies the action to all subdirectories of the specified directory, or of the current directory if none is specified. If :\DirName is used, the compressed attribute is not altered. 
 /i  Ignores errors.
 /f  Forces the action on a previously failed attempt. 
 /a  Display files with the Hidden and/or System attribute. 
 /q  Displays minimal information. 
 filename   Specifies the file or directory. You can use multiple filenames and wildcards. 

To compress the files in the current directroy and all subdirectories, type:

compact /c /s

To compress all files that end in .HTM in the \JSI directory and all subdirectories , but not modify the compressed attribute of these directories, type:

compact /c /s:\JSI *.HTM

To force complete compression of the file JSI.GIF, which was partially compressed at the time of a disk crash, type:

compact /c /f JSI.gif

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.