Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #108346

Re: Copy a folder's contents into another folder?

From GS <gs@v.invalid>
Newsgroups microsoft.public.excel.programming
Subject Re: Copy a folder's contents into another folder?
Date 2015-12-17 13:35 -0500
Organization A noiseless patient Spider
Message-ID <n4uv47$v9c$1@dont-email.me> (permalink)
References <uaqdnarMVc4uve_LnZ2dnUVZ5hKdnZ2d@giganews.com> <n4tiv2$s8l$1@dont-email.me>

Show all headers | View raw


Here's the remarks from Script56.chm (which is free) for the 
CopyFolder() method of FSO...

Remarks
Wildcard characters can only be used in the last path component of the 
source argument. For example, you can use:

[JScript]
fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CopyFolder ("c:\\mydocuments\\letters\\*", "c:\\tempfolder\\")
[VBScript]
FileSystemObject.CopyFolder "c:\mydocuments\letters\*", 
"c:\tempfolder\"
But you cannot use:

[JScript]
fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CopyFolder ("c:\\mydocuments\\*\\*", "c:\\tempfolder\\")
[VBScript]
FileSystemObject.CopyFolder "c:\mydocuments\*\*", "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.

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.
An error also occurs if a source using wildcard characters doesn't 
match any folders.

The CopyFolder method stops on the first error it encounters. No 
attempt is made to roll back any changes made before an error occurs.

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Copy a folder's contents into another folder? "Robert Crandal" <noreply2me@yahoo.com> - 2015-12-16 19:40 -0700
  Re: Copy a folder's contents into another folder? GS <gs@v.invalid> - 2015-12-17 01:01 -0500
    Re: Copy a folder's contents into another folder? GS <gs@v.invalid> - 2015-12-17 13:35 -0500
  Re: Copy a folder's contents into another folder? Claus Busch <claus_busch@t-online.de> - 2015-12-17 10:32 +0100
    Re: Copy a folder's contents into another folder? "Robert Crandal" <noreply2me@yahoo.com> - 2015-12-17 12:53 -0700
      Re: Copy a folder's contents into another folder? GS <gs@v.invalid> - 2015-12-17 15:52 -0500
        Re: Copy a folder's contents into another folder?  (.chm file error) "Robert Crandal" <noreply2me@yahoo.com> - 2015-12-17 16:17 -0700
          Re: Copy a folder's contents into another folder?  (.chm file error) GS <gs@v.invalid> - 2015-12-17 18:36 -0500
            Re: Copy a folder's contents into another folder?  (.chm file error) "Robert Crandal" <noreply2me@yahoo.com> - 2015-12-17 16:56 -0700
  Re: Copy a folder's contents into another folder? Claus Busch <claus_busch@t-online.de> - 2015-12-17 20:17 +0100

csiph-web