The NTFS Compression technology is transparent,
that when reading and writing, the compression
and decompression are handled automatically.
This is good and convenient. However, when
copying a NTFS-compress’d file, that file just
firstly gets decompressed in the reading process,
then gets compressed again in the writing process.
That is the case when copying a NTFS-compress’d
file into a folder than doesn’t automatically
compress new file.
When copying a NTFS-compress’d
file into a folder that automatically
compresses new file, there is an extra
step. When writing, the file gets compressed
again.
I haven’t tested, but I guess although
during the copy process the file is firstly
decompressed then compressed again, the
stored compressed data just gets unchanged.
That is, although the underlying compressed
data doesn’t get changed, the data gets
decompressed and compressed again,
which slows the copy process down, sometimes
quite significantly.
Therefore, it would be good if these is an
API that copies the NTFS-compress’d file
without decompressing and compressing again,
but just simply copy the underlying compressed
bytes.
However, it looks like although there is a
function LZCopy
, it doesn’t do this:
Copies a source file to a destination file. If the source file has been compressed by the Lempel-Ziv algorithm, this function creates a decompressed destination file. If the source file is not compressed, this function duplicates the original file.
(https://learn.microsoft.com/en-us/windows/win32/api/lzexpand/nf-lzexpand-lzcopy)
In short, is there a Windows API that
copies the NTFS-compress’d file without
decompressing and compressing again?
Or there is not one currently?