JSI Tip 0316 - Command line NTFS compression.

Jerold Schulman

November 14, 1997

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like