Here is an implementation that copies the content in a folder, including the content in the sub-folder, to the asp code in another folder. During use, you must convert the relative path of the folder to an absolute path. The conversion method is to use server. mappath.
<%
Startfile_1 = "d: \ aaa" 'original folder
Tofile_1 = "c: \ bbb" 'destination folder
Call copyfile (startfile_1, tofile_1)
Response. write "complete"
Function copyfile (startfile, tofile) 'startfile is the original folder path, and tofile is the target folder path.
Set MyFileObject = Server. CreateObject ("Scripting. FileSystemObject ")
Set MyFolder = MyFileObject. GetFolder (startfile)
Domain = Split (startfile, "\") (UBound (Split (startfile ,"\")))
For Each thing in MyFolder. Files 'copy the file
S = Split (thing ,"\")
A = UBound (s)
S3 = Split (thing, "\") ()
MyFileObject. CopyFile thing, tofile & "\" & s3
Next
For Each thing in MyFolder. SubFolders copy SubFolders
S = Split (thing ,"\")
A = UBound (s)
S3 = Split (thing, "\") ()
Response. write thing &"
"
Response. write s1 & "\" & domain & "\" & s3
Response. write"
"
MyFileObject. copyFolder thing, tofile & "\" & s3
Next
End function
%>