FolderExists 方法
请参阅
DriveExists 方法 | FileExists 方法 | GetFolder 方法 | GetParentFolderName 方法
应用于:FileSystemObject 对象
语言
JScriptVBScript显示所有语言
如果指定的文件夹存在则返回 True ;否则返回 False。object.FolderExists(folderspec)
参数
object 
必选项。应为 FileSystemObject 的名称。 
folderspec 
必选项。需要判定是否存在的文件夹的名称。如果文件夹可能不在当前文件夹中,那么必须提供完整的路径说明(可以是绝对的或相对的)。 
下面的例子说明了 FileExists 方法的用法。[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

解决方案 »

  1.   

    如果是在客户端使用FSO会有安全性警告
      

  2.   

    晕~~~检测服务器端的文件?那你怎么能用客户端脚本呢?你用什么?ASP?PHP?JSP?
      

  3.   

    我用asp的VB脚本呀,默认的不就是在服务器端执行后送到客户端吗?
      

  4.   

    http://search.csdn.net/expert/topic/3/301/2003/1/10/1344710.htm
      

  5.   

    麻烦一下,有没有JSCRIPT的代码呀?
      

  6.   

    自己顶一下!
    最好是JSCRIPT的函数,任务是检测某个页面是否存在,如果存在返回一个TRUE,否则返回FALSE!!!!谢谢各位!!!!
      

  7.   

    var fs = new ActiveXObject("Scripting.FileSystemObject");
    alert(fs.FolderExists("机器名\\file"));