Author Topic: IDrive.RootFolder Property  (Read 3484 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2530
  • User-Rate: +209/-0
  • Gender: Male
IDrive.RootFolder Property
« on: July 14, 2008, 05:14:05 AM »

The following example illustrates the use of the RootFolder property:

JScript

Code: [Select]
function GetRootFolder(drv)
{
   var fso,d;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   if (fso.DriveExists(drv))
      {
         d = fso.GetDrive(drv);
         return(d.RootFolder);
      }
   else
      return(false);
}

VBScript

Code: [Select]
Function GetRootFolder(drvspec)
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetDrive(drvspec)
   GetRootFolder = f.RootFolder
End Function

PowerBASIC

Code: [Select]
FUNCTION GetRootFolder (BYVAL drvspec AS STRING) AS STRING

   LOCAL fso AS IFileSystem
   LOCAL f AS IFile

   fso = NEWCOM ("Scripting.FileSystemObject")
   f = fso.GetDrive(UCODE$(drvspec))
   FUNCTION = ACODE$(f.RootFolder)

END FUNCTION