SoFunction
Updated on 2025-04-13

asp copy folder code


<%
Function CopyMyFolder(FolderName,FolderPath)
sFolder=(FolderName)
oFolder=(FolderPath)
set fso=("")
if ((FolderName)) Then'Check whether the original folder exists
if ((FolderPath)) Then'Check whether the target folder exists
    sFolder,oFolder
Else 'The target folder is created if it does not exist
            CreateNewFolder = (FolderPath)
            (CreateNewFolder)
             sFolder,oFolder
   End if
CopyMyFolder="Copy the folder ["&(FolderName)&"] to ["&(FolderPath)&"] successfully!"
Else
CopyMyFolder="Error, the original folder ["&sFolde&"] does not exist!"
End If
set fso=nothing
End Function
FolderName="2006" 'Original folder
FolderPath="2008" 'Target folder
""&CopyMyFolder(FolderName,FolderPath)&"" 'Copy all the contents in folder 2006 to the 2008 folder and return the result
%>