ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   filesystemobject (https://www.excelbanter.com/excel-programming/321796-filesystemobject.html)

Alvin Hansen[_2_]

filesystemobject
 
Hi

know this is excel forum but i don't know where else to write this

With filesystemobject i use createfolder and delete folder
but i can't find out how to use copy *.* from one folder to another folder

Hope some one can help --

Alvin


Bob Phillips[_6_]

filesystemobject
 
Hi Alvin ,

But you know how helpful we are :-).

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

These are the commenst on the MSDN page
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.

a.. If destination does not exist, the source folder and all its contents
gets copied. This is the usual case.
b.. If destination is an existing file, an error occurs.
c.. 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.
d.. 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.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alvin Hansen" wrote in message
...
Hi

know this is excel forum but i don't know where else to write this

With filesystemobject i use createfolder and delete folder
but i can't find out how to use copy *.* from one folder to another folder

Hope some one can help --

Alvin




K Dales[_2_]

filesystemobject
 
The copyfile method - see
http://msdn.microsoft.com/library/de...gwithfiles.asp

"Alvin Hansen" wrote:

Hi

know this is excel forum but i don't know where else to write this

With filesystemobject i use createfolder and delete folder
but i can't find out how to use copy *.* from one folder to another folder

Hope some one can help --

Alvin


Alvin Hansen[_2_]

filesystemobject
 
Yes yes yes

thank you, thank you

Alvin


"Bob Phillips" skrev:

Hi Alvin ,

But you know how helpful we are :-).

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

These are the commenst on the MSDN page
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.

a.. If destination does not exist, the source folder and all its contents
gets copied. This is the usual case.
b.. If destination is an existing file, an error occurs.
c.. 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.
d.. 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.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alvin Hansen" wrote in message
...
Hi

know this is excel forum but i don't know where else to write this

With filesystemobject i use createfolder and delete folder
but i can't find out how to use copy *.* from one folder to another folder

Hope some one can help --

Alvin






All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com