#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default FileCopy

Hi All,

Can File copy be used with the extension *.* in order to copy the contents
of folders or does another method need to be used?

i.e. will this work?

Filecopy "C:\temp1\*.*", "C:temp2\*.*"

Ta

Andi


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default FileCopy

I presume I need to use the filesystemobject.copyfolder method - would this
be fast enough for transfering 1/2gb of files or is there a quicker way?

"Andibevan" wrote in message
...
Hi All,

Can File copy be used with the extension *.* in order to copy the contents
of folders or does another method need to be used?

i.e. will this work?

Filecopy "C:\temp1\*.*", "C:temp2\*.*"

Ta

Andi



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default FileCopy

As you correctly figured, Filecopy does not work with wildcards. I have not
had any speed issues with FileSystemObject.
Alok Joshi

"Andibevan" wrote:

I presume I need to use the filesystemobject.copyfolder method - would this
be fast enough for transfering 1/2gb of files or is there a quicker way?

"Andibevan" wrote in message
...
Hi All,

Can File copy be used with the extension *.* in order to copy the contents
of folders or does another method need to be used?

i.e. will this work?

Filecopy "C:\temp1\*.*", "C:temp2\*.*"

Ta

Andi




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default FileCopy

Hello again,

Maybe you could make use of the Dir function, which returns the name of the
file when it exists or an empty string when not.

Especially its use in loops I find very practical (Dir without argument
returns
the next filename within the given range):

PathFrom = "c:\Temp1"
PathTo = "c:\Temp2"

varTest = Dir(PathFrom)

Do Until varTest = ""
From = PathFrom + "\" + varTest
To = PathTo + "\" + varTest
FileCopy From, To
varTest = Dir
Loop

It works fine, but how time consuming it is in your case, I don't know!

Maybe this could be of help to you,
Greetings,


PS:
Dir may be used with just a path or with wildcards, e.g.
"c:\TestFolder\a*.doc" ,
so you even could make selections this way.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default FileCopy (now OK!)

So sorry!

Almost always thoroughly testing, but not this time...
so at least two mistakes!

Here the correct code

PathFrom = "c:\Temp1" ' both paths should exist
PathTo = "c:\Temp2"

varTest = Dir(PathFrom + "\*.*") ' filename [wildcards allowed] necessary

Do Until varTest = ""
FileFrom = PathFrom + "\" + varTest
FileTo = PathTo + "\" + varTest ' now a better variable name!
FileCopy FileFrom, FileTo
varTest = Dir
Loop


Greetings again,
Peter



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default FileCopy

You could try:

Shell ("Command.com /c Copy C:\temp1\*.*, C:temp2\*.*")

You can check out this link.
http://support.microsoft.com/default...b;en-us;213800

HTH

"Andibevan" wrote:

I presume I need to use the filesystemobject.copyfolder method - would this
be fast enough for transfering 1/2gb of files or is there a quicker way?

"Andibevan" wrote in message
...
Hi All,

Can File copy be used with the extension *.* in order to copy the contents
of folders or does another method need to be used?

i.e. will this work?

Filecopy "C:\temp1\*.*", "C:temp2\*.*"

Ta

Andi




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default FileCopy

Thanks to all for your help on this one.

Regards

Andi

"Andibevan" wrote in message
...
I presume I need to use the filesystemobject.copyfolder method - would this
be fast enough for transfering 1/2gb of files or is there a quicker way?

"Andibevan" wrote in message
...
Hi All,

Can File copy be used with the extension *.* in order to copy the contents
of folders or does another method need to be used?

i.e. will this work?

Filecopy "C:\temp1\*.*", "C:temp2\*.*"

Ta

Andi




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
filecopy Question rjvega Excel Discussion (Misc queries) 2 July 8th 08 09:12 PM
FileCopy problem rju[_6_] Excel Programming 0 August 9th 04 05:05 PM
FileCopy and read-only Dkline[_2_] Excel Programming 2 April 14th 04 05:50 AM
FileCopy Dana DeLouis[_5_] Excel Programming 0 August 11th 03 12:57 PM
FileCopy John Green[_2_] Excel Programming 1 August 5th 03 08:55 AM


All times are GMT +1. The time now is 08:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"