4

I know it is possible to compress files on the commandline with LZX:

COMPACT /C /S:E:\Backup /EXE:LZX

But i would like to do that BEFORE the files gets written on the disk.

If i enable compression on the root folder via Explorer the files will get written with a weak compression method, while i'd like to use LZX.

  • 1
    Tags edited because the question involves a feature introduced in Windows 10. – bwDraco May 15 '17 at 2:07
10

You can't

It doesn't work the same way, is not heritable, you can't compress folders (themselves), you can't modify (or add) information to a LZX file while maintaining the compression, if you do so, the file is decompressed entirely, like a new file, and you need to re compress it again.

Compact help gives:

"Directories will be marked so that files added afterward will be compressed unless /EXE"

Adding a byte decompress the file:

echo a >> test.txt

LZX files are like "zip files" (more like GZ) made transparent to the OS, but they are not the same as common compressed files in the old NTFS way.

The solution I propose is using a scheduled task to run the compact command while the computer is idle (or run after backup), and also I recommend to only compact with LZX: dll and exe files in working programs, ( if they are not backups as your example ), to prevent potential slowdowns and issues (do not! compress the boot files in the root directory).

If your files are already compressed with the old method, you need to add /F to force re-compression the first time you do it, and remove the compression from the folder itself to prevent the "weak method" from being used, or make a more complex program to find and re-compress weak compressed files.

Also remember that LZX is not compatible with previous version of windows.

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.