Função em VBScript para criar uma pasta, o DirName pode ser um caminho absoluto ou relativo.
Public Function CreateFolder(ByVal DirName)
On Error Resume Next
If Mid(DirName, 2, 1) <> ":" Then
DirName = Server.MapPath(DirName)
End If
If Err Then Err.Clear
On Error GoTo 0
Dim FSO
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
On Error Resume Next
If FSO.FolderExists(DirName) Then
FSO.DeleteFolder DirName
End If
If Err Then
On Error GoTo 0
CreateFolder = False
Set FSO = Nothing
Exit Function
End If
FSO.CreateFolder DirName
If Err Then
On Error GoTo 0
CreateFolder = False
Set FSO = Nothing
Exit Function
End If
On Error GoTo 0
Set FSO = Nothing
CreateFolder = True
End Function
Nenhum comentário:
Postar um comentário