How to move or copy a folder in the web server
S T E P - 1
- We need to use the FileSystemObject object:
<%
Dim fSys, objNewFolder
Set fSys = CreateObject("Scripting.FileSystemObject")
%>
S T E P - 2
- Now, we can use the server.mappath(".") to get the web server's current folder
- We can move folder in the current folder by using MoveFolder method.
<%
Set objNewFolder = fSys.MoveFolder(server.mappath(".") & "\myFolder", server.mappath("..") & "\myFolder")
Response.write(objNewFolder.path)
Set objNewFolder = Nothing
Set objFileSys = Nothing
%>
S T E P - 3
- Now, we can use the server.mappath(".") to get the web server's current folder.
- We can move folder in the current folder by using CopyFolder method.
<%
Set objNewFolder = fSys.CopyFolder(server.mappath(".") & "\myFolder", server.mappath("..") & "\myFolder")
Response.write(objNewFolder.path)
Set objNewFolder = Nothing
Set objFileSys = Nothing
%>
No comments:
Post a Comment