| ASP函数FileSystemObject详解 |
|
| 作者:未知 来源:本站收集 时间:2006-10-23 23:01:08 『 字号:大 中 小 』
|
|
|
|
文章系统定位关系

asp函数FileSystemObject详解 Set fs=Server.CreateObject("Scripting.FileSystemObject") 1.文件是否存在 If (fs.FileExists("c:\winnt\cursors\3dgarro.cur"))=true Then Response.Write("File c:\winnt\cursors\3dgarro.cur exists.") Else Response.Write("File c:\winnt\cursors\3dgarro.cur does not exist.") End If 2.目录是否存在 If fs.FolderExists("c:\temp") = true Then Response.Write("Folder c:\temp exists.") Else Response.Write("Folder c:\temp does not exist.") End If 3.磁盘是否存在 if fs.driveexists("c:") = true then Response.Write("Drive c: exists.") Else Response.Write("Drive c: does not exist.") End If
Response.write("<br>")
if fs.driveexists("g:") = true then Response.Write("Drive g: exists.") Else Response.Write("Drive g: does not exist.") End If
4.获得文件所在的磁盘目录 p=fs.GetDriveName("c:\winnt\cursors\3dgarro.cur") Response.Write("The drive name is: " & p) 结果:c: 5.获得文件所在的文件目录 p=fs.GetParentFolderName("c:\winnt\cursors\3dgarro.cur") Response.Write("The parent folder name of c:\winnt\cursors\3dgarro.cur is: " & p) 结果:c:\winnt\cursors 6.获得文件的扩展名 Response.Write(fs.GetExtensionName("c:\winnt\cursors\3dgarro.cur")) 结果:cur 7.获得文件全名 Response.Write(fs.GetFileName("c:\winnt\cursors\3dgarro.cur")) 结果:3dgarro.cur 8.获得文件第一个名称 Response.Write(fs.GetBaseName("c:\winnt\cursors\3dgarro.cur")) Response.Write("<br />") Response.Write(fs.GetBaseName("c:\winnt\cursors\")) Response.Write("<br />") Response.Write(fs.GetBaseName("c:\winnt\")) 结果:3dgarro cursors winnt set fs=nothing
|
|
上一篇文章: ASP - FileSystemObject处理文件 下一篇文章: 防止别人偷看ASP的源代码 |
| 【发表评论】【打印本文】【关闭窗口】 |
| |