以下代码:
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(path) Then
fso.CreateFolder(path)
End If正在产生以下错误:
Microsoft VBScript运行时错误“800a003a”文件已经存在
如果我删除该文件夹,以便ASP能够创建它本身,它将按预期的方式工作。只有当我手动(或使用DOS MKDIR)创建它时,FolderExists才返回false,而CreateFolder抛出了上面的错误。
这里发生了什么事?
编辑:
包含字符串C:\Windows\Temp\email_attachments\和FolderExists的变量路径似乎返回自上次启动之前就已经存在的目录的false。
发布于 2018-03-13 12:33:06
嗨,我的工作代码。
file_path="C:\inetpub\wwwroot\upload\2018\4"
set fso=Server.CreateObject("Scripting.FileSystemObject")
tmpArr = Split(file_path, "\")
tmpPath = tmpArr(0)
For i = 1 To UBound(tmpArr)
If Not fso.FolderExists(Server.MapPath(tmpPath)) Then
fso.CreateFolder Server.MapPath(tmpPath)
End If
tmpPath = tmpPath & "\" & tmpArr(i)
Nexthttps://stackoverflow.com/questions/49254365
复制相似问题