Copying a file

this copies a file and makes a copy of it.

<%
'create a variable
Dim objFSO
'create an instance of the FileSystem object
Set objFSO = Server.CreateObject("Scripting.FileSystemobject")
'copy the file from d:\counter.txt to d:\counter.bak
objFSO.CopyFile "d:\counter.txt" , "d:\counter.bak"
'destroy object
Set objFSO = Nothing
%>

or you could copy all files of a certain type to a backup location like this

<%
Dim objFSO
'Create an instance of File System object
Set objFSO = Server.CreateObject("Scripting.FileSystemobject")
'copy all htm files to backup directory
objFSO.CopyFile "d:\htmlpages\*.htm" , "d:\backup\"
'destroy object
Set objFSO = Nothing
%>

Sponsors