File.Move Method (VB6)

Named Arguments

Yes

Syntax

oFileObj.Move destination


oFileObj

Use: Required

Data Type: File object

Any object variable returning a File object.


destination

Use: Required

Data Type: String

The path to the location where the file is to be moved.

Description

Moves a file from one folder to another.

Rules at a Glance

  • Wildcard characters can't be used in Destination.

  • Destination can be either an absolute or a relative path.

Programming Tips and Gotchas

  • If a fatal system error occurs during the execution of this method (like a power failure), the worst that can happen is that the file is copied to the destination but not removed from the source. There are no rollback capabilities built into the File.Move method; however, because the copy part of this two-stage process is executed first, the file can't be lost.

  • You can use the FileSystemObject's FileExists and GetAbsolutePath methods prior to calling the Move method to ensure its success.

  • Unlike the FileSystemObject's MoveFile method, which accepts wildcard characters in the path parameter and can therefore move multiple files, the Move method moves only the single file represented by oFileObj.

  • As a result of the Move method, the Files collection object containing oFileObj is automatically updated, the moved folder being removed and the collection count reduced by one. You shouldn't try to access the moved file object again in the same Folders collection object.

  • If the user has adequate rights, Destination can be a network path or share name. For example:

    oFile.Move "\NTSERV1d$RootTwomyfile.doc"

See Also

FileSystemObject.MoveFile Method
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.51.16