• Welcome to Jose's Read Only Forum 2023.
 

IDrive.RootFolder Property

Started by José Roca, July 14, 2008, 05:14:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following example illustrates the use of the RootFolder property:

JScript


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


Function GetRootFolder(drvspec)
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetDrive(drvspec)
   GetRootFolder = f.RootFolder
End Function


PowerBASIC


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