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

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

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

File Size On Disk


Question:

How can I retrieve the "size on disk" of a file (not the "size" which is returned from the filesize() function)

Answer:

fname="C:\wbdebug.txt"
fname=FileFullname(fname)
fsize=FileSize(fname)

driveletter=StrSub(fname,1,1)

allocationunit=DiskInfo(driveletter,1) * DiskInfo(driveletter,2)

fullunits=Int(fsize/allocationunit)
partialunits= fsize mod allocationunit

If partialunits==0 
   totalunits=fullunits
Else
   totalunits=fullunits+1
EndIf

sizeondisk=(totalunits+0.0) * allocationunit

Message(fsize,sizeondisk)

Article ID:   W16459
File Created: 2005:02:18:12:20:50
Last Updated: 2005:02:18:12:20:50