WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Files and Directories

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get the compressed file size

Keywords:       compressed file size 

Question:

We have some directorys that are set as compressed and would like to get the real file size. If we use the FileSize connamd it gives the size as if it is not compressed ie not on a compressed directory. If you right click and go to properties it will display both sizes.

Answer:




#DefineFunction GetCompressedFileSize(fn)
    ;This version will return incorrect numbers
    ;if compressed file size if over 2GB
    dll=StrCat(DirWindows(1),"kernel32.dll")
    fs=DllCall(dll,long:"GetCompressedFileSizeA",lpstr:fn,lpnull)
    Return(fs)

#EndFunction

compressedfn="C:\compressed\fn.txtl"


fsa=FileSize(compressedfn)
fsb=GetCompressedFileSize(compressedfn)
Message(fsa,fsb)

Article ID:   W15313
File Created: 2003:05:28:10:24:10
Last Updated: 2003:05:28:10:24:10