Author Topic: IFileSystem.FolderExists  (Read 2188 times)

0 Members and 1 Guest are viewing this topic.

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2524
  • User-Rate: +209/-0
  • Gender: Male
IFileSystem.FolderExists
« on: July 14, 2008, 02:56:48 AM »

The following example illustrates the use of the FolderExists method.

JScript

Code: [Select]
function ReportFolderStatus(fldr)
{
   var fso, s = fldr;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   if (fso.FolderExists(fldr))
      s += " exists.";
   else
      s += " doesn't exist.";
   return(s);
}

VBScript

Code: [Select]
Function ReportFolderStatus(fldr)
   Dim fso, msg
   Set fso = CreateObject("Scripting.FileSystemObject")
   If (fso.FolderExists(fldr)) Then
      msg = fldr & " exists."
   Else
      msg = fldr & " doesn't exist."
   End If
   ReportFolderStatus = msg
End Function

PowerBASIC

Code: [Select]
FUNCTION ReportFolderStatus (BYVAL strFolderSpec AS STRING) AS STRING

   LOCAL fso AS IFileSystem
   LOCAL strMsg AS STRING

   fso = NEWCOM ("Scripting.FileSystemObject")
   IF fso.FolderExists(UCODE$(strFolderSpec)) THEN
      strMsg = strFolderSpec & " exists."
   Else
      strMsg = strFolderSpec & " doesn't exist.")
   End If
   FUNCTION = strMsg

END FUNCTION