Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


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