在ASP中自动创建多级文件夹的函数(使用FSO)
FSO中有个方法是CreateFolder,但是这个方法只能在其上一级文件夹存在的情况下创建新的文件夹,所以我就写了一个自动创建多级文件夹的函数,在生成静态页面等方面使用非常方便.
函数: Dim astrPath, ulngPath, i, strTmpPath If InStr(strPath, "\") <=0 Or InStr(strPath, ":") <= 0 Then 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:\a\b\c\" 上一篇:利用instr()函数防止SQL注入攻击 下一篇:表单对象textarea内容的格式控制(回车、换行、空格) 更多相关文章
|
推荐文章
精彩文章
·数据采集
|