Folder.Move Method (VB6)

Named Arguments

Yes

Syntax

oFolderObj.Move destination


oFolderObj

Use: Required

Data Type: Folder object

Any object variable returning a Folder object.


destination

Use: Required

Data Type: String

The path to the location where the folder or folders are to be moved.

Description

Moves a folder structure from one location to another.

Rules at a Glance

  • Wildcard characters can't be used in Destination.

  • If any of the files within the folder being moved are open, an error is generated.

  • All subfolders and files contained within the source folder are copied to Destination, unless disallowed by the wildcard characters. That is to say, the Move method is recursive.

  • 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 folder is copied to the destination but not removed from the source. There are no roll-back capabilities built into the Folder.Move method, however, since, because the copy part of this two-stage process is executed first, the folder can't be lost.

  • If an error occurs in the middle of a move operation, the operation is terminated immediately, and the remaining files and folders in the folder aren't moved.

  • To ensure its success, you can use the FileSystemObject's FolderExists and GetAbsolutePath methods prior to calling the Move method.

  • Unlike the FileSystemObject's MoveFolder method, which accepts wildcard characters in the source parameter and can therefore move multiple folders, the Move method moves only the single folder represented by the Folder object and its contents.

  • Immediately after the Move method executes, the Folders collection object containing the Folder object is automatically updated, the moved folder is removed from the collection and the collection count is reduced by one. You shouldn't try to access the moved folder object again from the same Folders collection object.

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

    Move "\NTSERV1d$RootTwo"

See Also

FileSystemObject.MoveFolder Method
..................Content has been hidden....................

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