• Welcome to Jose's Read Only Forum 2023.
 

IFileSystem.FolderExists

Started by José Roca, July 14, 2008, 02:56:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following example illustrates the use of the FolderExists method.

JScript


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


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


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