Metode Copy ASP

definisi dan penggunaan

Metode Copy mengcopy fail atau folder daripada lokasi yang satu ke lokasi yang lain.

syarat:

FileObject.Copy(destination[,overwrite])
FolderObject.Copy(destination[,overwrite])
parameter deskripsi
destination wajib. Tujuan penyalin fail atau folder. Tidak diizinkan untuk menggunakan wildcard.
overwrite pilihan. Menunjukkan sama ada boleh menimpa fail atau folder yang ada atau bukan. True bermakna fail atau folder boleh ditimpa, false bermakna fail atau folder tidak boleh ditimpa. Laporan adalah true.

contoh untuk objek File

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
f.Copy("d:\new_file.txt",false)
set f=nothing
set fs=nothing
%>

contoh untuk objek Folder

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
fo.Copy("d:\new_file",false)
set fo=nothing
set fs=nothing
%>