4

Is it possible to keep all the files within a NTFS-compressed folder compressed?

For example, if I have a compressed a folder using NTFS compression, it will compress all the files inside the folder as well. However, when I copy a file that is not compressed into the folder, the file won't automatically compress, it will stay uncompressed. Is it possible to force compress the files when moving them in (and potentially uncompress when moving out)?

I would like to use this on backup folders etc. Also, I would like to keep using the original NTFS compression if possible, it's very convenient

7

When you copy uncompressed files into a NTFS compressed folder the compression level isn't changed, and you cannot set them to compress them automatically (only newly created files are created as compressed). Instead you have to use compact.exe to compress all the files in the folder after you have moved files in there. You can do this using a batch file - change directory to the compressed directory and run the command:

compact /c (use /s to include subdirectories)

or, to save changing directory:

compact /c "c:\compressedfolder\*.*"

2

Windows natively supports ZIP compression, but not in a manner that allows transparent access to the files contained in ZIP files. If you are short on disk space and wish to compress files in a directory without impacting how the files are accessed (at least at higher levels), if the hard drive is using the NTFS filesystem, you can right-click on any directory and select Properties. In this window, click the Advanced button in the File Attributes section, and then put a check in the box labelled Compress contents to save disk space.

  • 1
    And don't mix it with ZIP compression to save space. Double-compressing will yield worse results than filesystem compression alone. – gronostaj Jan 13 '14 at 8:08
  • 1
    This is true, but other than the wasted space from double-compressing, you won't do any harm by putting a .ZIP (or other compressed) file into an NTFS-compressed directory. – DopeGhoti Jan 13 '14 at 8:09
  • 1
    Yes but that doesn't have the intended behavior. If I do it this way and then move an uncompressed file in that folder, it will not get compressed. It will stay uncompressed. This makes it rather useless for let's say backup folders where I put in various files over time. I'm well aware of NTFS compression, my question is actually targeted at this compression. I guess I didn't write it clear enough. – Kraken Jan 13 '14 at 8:11
  • @Kraken maybe I don't understand something. You want to have both ZIP and NTFS compression in some backup directory and copying new files doesn't zip them automatically, but NTFS compression works. Am I right? – gronostaj Jan 13 '14 at 11:34
  • Sorry if the original question confused you. Forget about ZIP. I want to put a NTFS-uncompressed file into a NTFS-compressed folder. What happens is that the file is still uncompressed. So for example if I make a NTFS-compressed folder Foo and put NTFS-uncompressed file Bar.txt in it, it won't automatically compress the file. Only if I create the file in there or re-apply compression on the whole folder again, it will compress Bar.txt. I was wondering if there was a way to automatically compress Bar.txt when putting in Foo (as Foo is a NTFS-compressed folder). – Kraken Jan 13 '14 at 11:57

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.