Monday, December 17, 2007

How to copy a text to another folder

How to copy a text to another folder

S T E P - 1

- We need to use the FileSystemObject object:

<%

Dim fSys

Set fSys = CreateObject("Scripting.FileSystemObject")

%>

S T E P - 2

- We can use the server.mappath(".") to get the webserver's current folder.

- So, we save the text file to the upper folder - server.mappath(".."),

- Now we can use the CopyFile method to copy the file to the upper folder.

<%

fSys.CopyFile server.mappath(".") & "\myFile.txt", server.mappath("..") & "\"

response.write("Process copy file")

Set fSys = Nothing

%>


No comments: