Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Wanna-Be C# Superstar
  • Administrators
Posted

If you are simply refering to NTFS compression via explorer rather than any internal TIFF compression the following should do the trick.

If System.IO.File.GetAttributes("c:\autoexec.bat") And IO.FileAttributes.Compressed = IO.FileAttributes.Compressed Then
   MessageBox.Show("Compressed")
End If

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

The property I'm 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 it's returning compressed for all of my files including the ones that are uncompressed in the image>compression property I mentioned above.

Wanna-Be C# Superstar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...