ASP Move 方法

定義和用法

Move 方法把指定的文件或文件從一個位置移動到另外一個位置。

注釋:對 File 或 Folder 應用 Move 方法的結果與使用 FileSystemObject.MoveFile 或 FileSystemObject.MoveFolder 執行的操作完全相同。然而,要注意的是 FileSystemObject.MoveFile 或 FileSystemObject.MoveFolder 方法可移動多個文件或文件夾。

語法:

FileObject.Move(destination)
FolderObject.Move(destination)
參數 描述
destination 必需的。移動文件或文件夾的目的地。允許使用通配符。

針對 File 對象的例子

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

針對 Folder 對象的例子

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
fo.Move("c:\asp\test")
set fo=nothing
set fs=nothing
%>