Is the file compressed?

VBAHole22

Well-known member
Joined
Oct 21, 2003
Messages
432
Location
VA
Is there any easy way to find out if a file is compressed?
I have some tif images that are compressed and some that I need to compress. How can I differentiate which are which in code?
I can right click in windows exploder and see the compression attribute but how can I get at it in code?
 
If you are simply refering to NTFS compression via explorer rather than any internal TIFF compression the following should do the trick.
Code:
If System.IO.File.GetAttributes("c:\autoexec.bat") And IO.FileAttributes.Compressed = IO.FileAttributes.Compressed Then
    MessageBox.Show("Compressed")
End If
 
The property Im refering to is under the image tab when I right-click on the file and select properties in explorer (win2k).

That code is very interesting. How does it work?

Unfortunately its returning compressed for all of my files including the ones that are uncompressed in the image>compression property I mentioned above.
 
Back
Top