Announcement

Collapse
No announcement yet.

how do i know if there is a partition d or e or f and how do i know a available space

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how do i know if there is a partition d or e or f and how do i know a available space

    friends;
    how do i know if there is a partition d or e or f and how do i know a available space
    thank you

  • #2
    how do i know if there is a partition d or e or f
    Use Drive.Enumerate().

    and how do i know a available space
    Use Drive.GetFreeSpace().

    You may benefit from reading the product documentation.

    Ulrich


    Comment


    • #3
      thank you for your answer


      i create this code to ckeck available space on hardisk
      space_availabled = Drive.GetFreeSpace("D:");

      but this is static

      i want dynamic using Drive.Enumerate()

      can you help me to use
      with for next loop to check drives

      then check space available for each drive

      and do the following


      if (space_available > 300) then
      Folder.Create("D:\MyApps")

      else if( space_available > 300) then
      Folder.Create("E:\MyApps")

      end

      another one i want to change AppFolder by code

      as like this
      appfolder="D:\MyApps"

      i hope undestand my
      your help is very appreciated

      Comment


      • #4
        Here is a sample:
        Code:
        local tDriveList = Drive.Enumerate();
        
        Debug.ShowWindow();
        for i = 1, Table.Count(tDriveList) do
            local nMegabytes = Drive.GetFreeSpace(tDriveList[i])
            if (nMegabytes ~= -1) then
            local nBytes = nMegabytes * 1000000;
                Debug.Print(String.Left(tDriveList[i], 2) .. " = " ..  String.GetFormattedSize(nBytes, FMTSIZE_AUTOMATIC, false) .. "\r\n");
            else
                Debug.Print(String.Left(tDriveList[i], 2) .. " = unknown\r\n");
            end
        end
        Results will be displayed in the Debug window, like so:

        Click image for larger version

Name:	SCRN-2017-08-07-01.png
Views:	36
Size:	3.5 KB
ID:	298094

        Ulrich

        Comment

        Working...
        X