Table of contents

MoveFolder 方法MoveFolder Method

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

说明将一个或多个文件夹从一个位置移动到另一个。语法对象MoveFolder目标MoveFolder方法的语法包含以下成分:Description Moves one or more folders from one location to another. Syntaxobject. MoveFoldersource, destination The MoveFolder method syntax has these parts:

objectobject必填。始终FileSystemObject名称。Required. Always the name of a FileSystemObject.
sourcesource必填。指向要移动的文件夹的路径。源_参数字符串可以包含通配符中最后一个路径组件。Required. The path to the folder or folders to be moved. The _source argument string can contain wildcard characters in the last path component only.
目标destination必填。位置的路径或多个文件夹要移动。目标_参数不能包含通配符字符。Required. The path where the folder or folders are to be moved. The _destination argument can't contain wildcard characters.

备注如果_源_包含通配符或_目标_结尾的路径分隔符 (\ ),则假定该_目标_指定一个现有文件夹来移动匹配的文件。否则,假定_目标_是要创建的目标文件夹的名称。在任一情况下,移动单个文件夹时,可以执行三个操作:Remarks If source contains wildcards or destination ends with a path separator ( \ ), it is assumed that destination specifies an existing folder in which to move the matching files. Otherwise, destination is assumed to be the name of a destination folder to create. In either case, three things can happen when an individual folder is moved:

  • 如果_目标_不存在,则获取移动文件夹。这是常见的情况。If destination does not exist, the folder gets moved. This is the usual case.

  • 如果_目标_是一个现有文件,则会导致出错。If destination is an existing file, an error occurs.

  • 如果_目标_是一个目录,则会导致出错。If destination is a directory, an error occurs.

如果_源_中使用的通配符字符不匹配的任何文件夹,也会发生错误。MoveFolder方法在遇到的第一个错误停止。不尝试回滚错误发生之前所做的任何更改。An error also occurs if a wildcard character that is used in source doesn't match any folders. The MoveFolder method stops on the first error it encounters. No attempt is made to roll back any changes made before the error occurs.

重要 此方法允许卷之间移动文件夹,仅当操作系统支持。Important This method allows moving folders between volumes only if supported by the operating system.

© 2018 Microsoft