7

I want to enable NTFS compression on a specific folder, in my case: C:\inetpub\logs.

This is easily done in Windows Server with Desktop Experience, but in Server Core how this can be achieved?

To be precise I just want the equivalent of checking the box "Compress contents to save disk space".

NTFS Folder Compression

1
  • As an alternative, you could write a utility to zip up all the logs for a month and perhaps migrate them to yearly folders, and run it as a scheduled task. – Andrew Morton Aug 2 '19 at 16:35
7

There is the compact utility that can change compression attribute from the command line. For example to set compression for the c:\docs directory and all files in it:

> compact /c /s:c:\docs *

A good description of the compact command is here: Compressing a File or Folder

You should be aware of the limitations of NTFS compression before deciding to use it. Please see Understanding NTFS Compression.

2
  • Thanks! With this command, new created files will be automatically compressed too? – Vinícius Ferrão Aug 2 '19 at 15:31
  • Yes, the new files created in the directory and its subdirectories later on will be compressed also – mebius99 Aug 5 '19 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.