O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

FileSystemObject.MoveFolder Method

Syntax

                  oFileSysObj
                  .MoveFolder source, destination
oFileSysObj

Use: Required

Data Type: FileSystemObject object

A FileSystemObject object.

source

Use: Required

Data Type: String

The path to the folder or folders to be moved.

destination

Use: Required

Data Type: String

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

Description

Moves a folder along with its files and subfolders from one location to another.

Rules at a Glance

  • source must end with either a wildcard character or no path separator.

  • Wildcard characters can be used in source, but only for the last component.

  • Wildcard characters can’t be used in destination.

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

  • If destination ends with a path separator or Source ends with a wildcard, MoveFolder assumes the folder in Source exists in Destination. For example:

    C:\
       Rootone
          SubFolder1
          SubFolder2
       RootTwo

    The command MoveFolder "c:\Rootone\*", "C:\RootTwo\" produces this folder structure:

    C:\
       Rootone
       RootTwo
          SubFolder1
          SubFolder2

    The command MoveFolder "c:\Rootone", "C:\RootTwo\" produces this folder structure:

    C:\
       RootTwo
          Rootone
             SubFolder1
             SubFolder2
  • source and destination can be either absolute or relative paths.

  • source and destination can be network paths or share names.

Programming Tips and Gotchas

  • MoveFolder resolves both arguments before starting the operation.

  • If a fatal ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required