Compress individual files on NTFS with compact
Transparent per-file NTFS compression — files stay directly readable, no zip archive required.
01Command
$ compact /c /i /q C:\Logs\*.log02What it does
compact applies the NTFS compressed attribute, so the OS decompresses files on read automatically and every application sees them normally. It is per-file/folder and separate from compactos, which compresses Windows' own binaries. Compression works best on text-like data (logs, documents) and does nothing for already-compressed media. compact /s:<dir> applies to a whole subtree.
03Risk
04Undo
$ compact /u /i /q C:\Logs\*.log05Sources
- COMPACT - Windows CMDEvidence: SS64 explains compact as NTFS per-file compression, distinct from compactos whole-OS binary compression, with /c, /u and wildcards.
- compact | Microsoft LearnEvidence: Microsoft documents compact /c to compress NTFS files or directories and /u to uncompress them, with /i to ignore errors and /q for quiet reporting.
Last verified: 2026-09-17 · Category: Files & Folders
06Related solutions
Diagnose NTFS file system errors and bad sectors on any volume — including the system drive while Windows is running — before committing to a repair.
Robocopy is Windows' built-in robust file copier: use /MIR to keep a destination folder as an exact one-way mirror of a source, resumable and restartable.
Two-step command sequence that makes you the owner of a locked file tree and grants yourself full control — the standard fix for 'Access is denied' on old profiles and OS reinstall leftovers.