Problem with free space checker

  • 14 years ago

    Hello,

    I'm working on a backup script. And i'm now making a script to check how much freespace
    there is on the USB-disk. And a different check to see how big the file is what he needs to backup.

    For Example i got these values:
    objLogicalDisk.FreeSpace = 25634826 (freespace on USB-disk)
    FileSize = 1873152 (file size what he needs to backup)

    These values are in bytes!

    And i got this script:

    Call StatusschermText( objLogicalDisk.FreeSpace & "-" & FileSize )

    If ("FileSize" > "objLogicalDisk.Freespace") then
    msgbox "STOP!!"

    Else
    msgbox "go on...."
    End If









    I want to get if the FileSize is bigger or equal then the objLogicalDisk.Freespace to get
    the message: STOP

    And if the value FileSize is smaller the objLogicalDisk.FreeSpace to get the message: go on....

    But with the script i have now it's always showing me the message go on....
    Can anyone tell me what I am doing wrong?























  • 14 years ago
    Shouldn't
    If ("FileSize" > "objLogicalDisk.Freespace") then
    be
    If (FileSize > objLogicalDisk.Freespace) then

    Since you had quotes, it was comparing the literal String and not the numeric variables.






  • 14 years ago

    Thanks for the answer!

    I tried it but it doesn't worked. So i tried a few more things and finally i got the problem. The values FileSize and objLogicalDisk.Freespace were in bytes. And when i made those values in MB's it worked just fine!

    So thanks for your help!

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Linux is only free if your time has no value” - Jamie Zawinski