ASP 在线拷贝文件夹

<%
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")  '文件件操作

Function ReportFolderStatus(fldr)
    Dim msg
    msg = -1
    If (objFSO.FolderExists(fldr)) Then
        msg = 1
    Else
        msg = -1
    End If
    ReportFolderStatus = msg
End Function
Function CopyAFolder(SourceFolder, DestinationFolder)
    Dim MyFolder
    If ReportFolderStatus(SourceFolder) = 1 And ReportFolderStatus(DestinationFolder) = -1 Then
        Set MyFolder = objFSO.GetFolder(SourceFolder)
        objFSO.CopyFolder SourceFolder, DestinationFolder
        CopyAFolder = 1
    Else
        CopyAFolder = -1
    End If
End Function



Call CopyAFolder(Server.MapPath("源文件夹"),Server.MapPath("新拷贝的文件夹"))
Set objFSO = Nothing    '关闭文件操作
%>

你可能感兴趣的:(asp)