ASP Copy ·½·¨

¶¨ÒåºÍÓ÷¨

Copy ·½·¨¿É°ÑÖ¸¶¨µÄÎļþ»òÎļþ¼Ð´ÓÒ»¸öλÖÿ½±´µ½ÁíÍâÒ»¸öλÖá£

×¢ÊÍ£º¶Ô File »ò Folder Ó¦Óà Copy ·½·¨µÄ½á¹ûÓëʹÓà FileSystemObject.CopyFile »ò FileSystemObject.CopyFolder Ö´ÐеIJÙ×÷ÍêÈ«Ïàͬ¡£ÔÚ FileSystemObject.CopyFile »ò FileSystemObject.CopyFolder ÖУ¬Ê¹Óà object ÒýÓÃÎļþ»òÎļþ¼Ð£¬²¢½«Îļþ»òÎļþ¼Ð×÷Ϊ²ÎÊý´«µÝ¸ø FileSystemObject.CopyFile »ò FileSystemObject.CopyFolder¡£È»¶ø£¬Ó¦¸Ã×¢ÒâµÄÊÇ FileSystemObject.CopyFile »ò FileSystemObject.CopyFolder ·½·¨¿ÉÒÔ¸´Öƶà¸öÎļþ»òÎļþ¼Ð¡£

Óï·¨£º

FileObject.Copy destination [,overwrite]
FolderObject.Copy destination [,overwrite]
²ÎÊý ÃèÊö
destination ±ØÐèµÄ¡£¸´ÖÆÎļþ»òÎļþ¼ÐµÄÄ¿µÄµØ¡£²»ÔÊÐíʹÓÃͨÅä·û¡£
overwrite ¿ÉÑ¡µÄ¡£Ö¸Ê¾ÊÇ·ñ¿É¸²¸ÇÒÑÓеÄÎļþ»òÎļþ¼ÐµÄ²¼¶ûÖµ¡£True ±íʾÎļþ/Îļþ¼Ð¿É±»¸²¸Ç£¬false ±íʾÎļþ/Îļþ¼Ð²»¿ÉÒÔ±»¸²¸Ç¡£Ä¬ÈÏÊÇ true¡£

Õë¶Ô File ¶ÔÏóµÄÀý×Ó

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

Õë¶Ô Folder ¶ÔÏóµÄÀý×Ó

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