Language Reference |
See Also Applies To
Recursively copies a folder from one location to another.
object.CopyFolder ( source, destination[, overwrite] );
The CopyFolder method syntax has these parts:
Part Description object Required. Always the name of a FileSystemObject. source Required. Character string folder specification, which can include wildcard characters, for one or more folders to be copied. destination Required. Character string destination where the folder and subfolders from source are to be copied. Wildcard characters are not allowed. overwrite Optional. Boolean value that indicates if existing folders are to be overwritten. If True, files are overwritten; if False, they are not. The default is True.
Wildcard characters can only be used in the last path component of the source argument. For example, you can use:But you can't use:FileSystemObject.CopyFolder ("c:\mydocuments\letters\*", "c:\tempfolder\")If source contains wildcard characters or destination ends with a path separator (\), it is assumed that destination is an existing folder in which to copy matching folders and subfolders. Otherwise, destination is assumed to be the name of a folder to create. In either case, four things can happen when an individual folder is copied.FileSystemObject.CopyFolder ("c:\mydocuments\*\*", "c:\tempfolder\")
An error also occurs if a source using wildcard characters doesn't match any folders.
- If destination does not exist, the source folder and all its contents gets copied. This is the usual case.
- If destination is an existing file, an error occurs.
- If destination is a directory, an attempt is made to copy the folder and all its contents. If a file contained in source already exists in destination, an error occurs if overwrite is False. Otherwise, it will attempt to copy the file over the existing file.
- If destination is a read-only directory, an error occurs if an attempt is made to copy an existing read-only file into that directory and overwrite is False.
The CopyFolder method stops on the first error it encounters. No attempt is made to roll back any changes made before an error occurs.
© 1997 by Microsoft Corporation. All rights reserved.
|file: /Techref/inet/iis/jscript/htm/js302.htm, 4KB, , updated: 1997/9/30 03:44, local time: 2018/12/18 12:15,
|©2018 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.piclist.com/techref/inet/iis/jscript/htm/js302.htm"> CopyFolder Method</A>
|Did you find what you needed?|
PICList 2018 contributors:
o List host: MIT, Site host massmind.org, Top posters @20181218 RussellMc, Van Horn, David, Sean Breheny, David C Brown, Neil, Isaac M. Bavaresco, Bob Blick, Harold Hallikainen, AB Pearce - UKRI STFC, John Gardner,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!