Microsoft® Visual Basic® Scripting Edition Move Method |
Scripting Run-Time Reference Version 3 |
Moves a specified file or folder from one location to another.
object.Move destinationThe Move method syntax has these parts:
Part Description object Required. Always the name of a File or Folder object. destination Required. Destination where the file or folder is to be moved. Wildcard characters are not allowed.
The results of the Move method on a File or Folder are identical to operations performed using FileSystemObject.MoveFile or FileSystemObject.MoveFolder. You should note, however, that the alternative methods are capable of moving multiple files or folders.The following example illustrates use of the Move method:
Dim fso, MyFile Set fso = CreateObject("Scripting.FileSystemObject") Set MyFile = fso.CreateTextFile("c:\testfile.txt", True) MyFile.WriteLine("This is a test.") MyFile.Close Set MyFile = fso.GetFile("c:\testfile.txt") MyFile.Move "c:\windows\desktop\"