|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
FSO中有个方式是CreateFolder,但是这个方式只能在其上一级文件夹存在的情况下创建新的文件夹,所以我就写了一个自动创建多级文件夹的函数,在生成静态页面等方面使用异常方便. 函数: \\\' -------------------------------- \\\' 自动创建指定的多级文件夹 \\\' strPath为绝对路径 \\\' 引用请保留版权 \\\' by im286_Anjer \\\' 2005-4-3 Function AutoCreateFolder(strPath) \\\' As Boolean On Error Resume Next Dim astrPath, ulngPath, i, strTmpPath Dim objFSO If InStr(strPath, "") <=0 Or InStr(strPath, ":") <= 0 Then AutoCreateFolder = False Exit Function End If Set objFSO = Server.CreateObject("Scripting.FileSystemObject") If objFSO.FolderExists(strPath) Then AutoCreateFolder = True Exit Function End If astrPath = Split(strPath, "") ulngPath = UBound(astrPath) strTmpPath = "" For i = 0 To ulngPath strTmpPath = strTmpPath & astrPath(i) & "" If Not objFSO.FolderExists(strTmpPath) Then \\\' 创建 objFSO.CreateFolder(strTmpPath) End If Next Set objFSO = Nothing If Err = 0 Then AutoCreateFolder = True Else AutoCreateFolder = False End If End Function 调用方式: MyPath = "C:abc" If AutoCreateFolder(MyPath) Then Response.Write "创建文件夹成功" Else Response.Write "创建文件夹失败" End If 返回类别: 教程 上一教程: ASP编写的一个简朴的颜色吸取器 下一教程: 关于客户端用ASP参生报表(高级篇) 您可以阅读与"在ASP中自动创建多级文件夹的函数(使用FSO)"相关的教程: · 在ASP中自动创建多级文件夹的函数 · 在不支持FSO的服务器上使用XMLDOM创建HTML文件 · 用ASP随机生成文件名的函数 · 大灰狼的ASP工具箱??用ASP读INI配置文件的函数 · ASP里使用MD5加密的函数及示例 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |