Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The use of CopyFolder method in VBS

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "the use of CopyFolder method in VBS". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the use of CopyFolder method in VBS".

Recursively copy a folder from one location to another.

Object.CopyFolder source, destination [, overwrite]

Parameter object

Required. Expected the name of the FileSystemObject object.

Source

Required. A string that represents the specified folder. Use wildcards when you want to copy one or more folders.

Destination

Required. A string that represents the target location to which you copy the source folder or subfolder. Wildcards are not allowed.

Overwrite

Optional. The Boolean value indicates whether the existing folder is overwritten. If True, the file is overwritten; if False, the file is not overwritten. The default value is True.

Description

Wildcards can only be used in the last part of the path of the source parameter. For example, you can use:

FileSystemObject.CopyFolder "c:\ mydocuments\ letters\ *", "c:\ tempfolder\"

However, you cannot use:

FileSystemObject.CopyFolder "c:\ mydocuments\ *\ *", "c:\ tempfolder\"

If source contains wildcards or destination ends with a path separator (\), copy a matching folder or subfolder in that folder, assuming that destination is an existing folder. Otherwise, assume that destination is the folder you want to create. In either case, when you copy a single folder, the following four things happen.

If destination does not exist, copy the source folder and all its contents. This is what usually happens.

If destination is a file that already exists, an error occurs.

If destination is a directory, copy the folder and all its contents. If the file contained in source already exists in destination and the overwrite is False, an error will occur. Otherwise, copy the file to overwrite the existing file.

If destination is a read-only directory, an error occurs when an existing read-only file is copied to that directory and overwrite is False.

An error can also occur if source uses wildcards but does not match the file.

The CopyFolder method stops when the first error is encountered. This method does not undo any changes made before the error occurred.

Thank you for your reading, the above is the content of "the use of CopyFolder method in VBS". After the study of this article, I believe you have a deeper understanding of the use of CopyFolder method in VBS, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report