ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileCopy (https://www.excelbanter.com/excel-programming/329161-filecopy.html)

Andibevan[_2_]

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



Andibevan[_2_]

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




Alok

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





Peter_A_M (NL)

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.



Peter_A_M (NL)

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


Jim Thomlinson[_3_]

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





Andibevan[_2_]

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






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

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