471,338 Members | 1,063 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

Copy all files from a folder to another folder, recursively


What is the most current (for framework 2.0) and easy way to copy
recursively
all files from folder "Folder1" to folder "Folder2" ?

Is there any simple function in the framework to do that?
-P

Jul 19 '07 #1
9 5476
Hi pamela,

See there: http://xneuron.wordpress.com/2007/04...irectory-in-c/

No easy way, except, probably, Process.Start("xcopy", "c:\old c:\new /O /X
/E /H /K") or Win API functions.

Regards, Alex
[TechBlog] http://devkids.blogspot.com

pfWhat is the most current (for framework 2.0) and easy way to copy
pfrecursively
pfall files from folder "Folder1" to folder "Folder2" ?
pfIs there any simple function in the framework to do that?
pf>
pf-P
pf>
Jul 19 '07 #2
One option is to use RoboCopy... it is very powerful, free, and can be
called from batch files. Google RoboCopy to learn more.

-HTH

"pamela fluente" <pa***********@libero.itwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
>
What is the most current (for framework 2.0) and easy way to copy
recursively
all files from folder "Folder1" to folder "Folder2" ?

Is there any simple function in the framework to do that?
-P

Jul 19 '07 #3
On Jul 19, 11:20 am, pamela fluente <pamelaflue...@libero.itwrote:
What is the most current (for framework 2.0) and easy way to copy
recursively
all files from folder "Folder1" to folder "Folder2" ?

Is there any simple function in the framework to do that?

-P
http://www.bubble-media.com/cgi-bin/...es/000026.html

Try it and let us know how it works! (I haven't, I just found it with
a Google search to answer your question, but I can see the use for
it!)
Jul 19 '07 #4
On 19 Lug, 18:06, Alex Meleta <amel...@gmail.comwrote:
Hi pamela,

See there:http://xneuron.wordpress.com/2007/04...and-its-conten...

No easy way, except, probably, Process.Start("xcopy", "c:\old c:\new /O /X
/E /H /K") or Win API functions.

Regards, Alex
[TechBlog]http://devkids.blogspot.com

pfWhat is the most current (for framework 2.0) and easy way to copy
pfrecursively
pfall files from folder "Folder1" to folder "Folder2" ?
pfIs there any simple function in the framework to do that?
pf>
pf-P
pf>
Thanks. Very nice.

Jul 19 '07 #5

"pamela fluente" <pa***********@libero.itwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
>
What is the most current (for framework 2.0) and easy way to copy
recursively
all files from folder "Folder1" to folder "Folder2" ?

Is there any simple function in the framework to do that?
The framework seems to have a hole there. Notice how on this page:
http://msdn2.microsoft.com/en-us/lib...ry(VS.71).aspx

"Copy a directory" has no example. Then click to the 2005 or Orcas version
of the page... "Copy a directory" is gone.

p/invoke to http://msdn2.microsoft.com/en-us/library/ms647743.aspx
>
-P

Jul 19 '07 #6
pamela fluente wrote:
What is the most current (for framework 2.0) and easy way to copy
recursively
all files from folder "Folder1" to folder "Folder2" ?

Is there any simple function in the framework to do that?
-P
I don't know if I'm missing something here, but why not just use the
FileSystem.CopyDirectory(SourceDIR, DestinationDIR) method?

If your reason for wanting it done "Recursively" is because you want to
monitor the progress or trap for errors, then just use some of the
available options provided by this Method.

See "CopyDirectory method" in Help for full details.
ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
Jul 20 '07 #7
On Fri, 20 Jul 2007 10:04:39 +1000, ShaneO <sp****@optusnet.com.au>
wrote:
>pamela fluente wrote:
>What is the most current (for framework 2.0) and easy way to copy
recursively
all files from folder "Folder1" to folder "Folder2" ?

Is there any simple function in the framework to do that?
-P
I don't know if I'm missing something here, but why not just use the
FileSystem.CopyDirectory(SourceDIR, DestinationDIR) method?

If your reason for wanting it done "Recursively" is because you want to
monitor the progress or trap for errors, then just use some of the
available options provided by this Method.

See "CopyDirectory method" in Help for full details.
ShaneO
Kind of a half-baked method. No filter options and
stuck in the VisualBasic namespace rather than the core
framework. No options for recursion depth either.

But perfect answer to the original question.

Regards,

Joergen Bech

Jul 20 '07 #8
Joergen Bech <jbech<NOSPAM>@ wrote:
Kind of a half-baked method.
"half-baked"??? It is a fully mature method, can't see what's
half-baked about it? I can write complex Win32 API calls to accomplish
tasks or purchase 3rd party add-ins just as much as anyone, but choosing
to use, say, the "File.Open" method doesn't make that half-baked in my
opinion! :-)
No filter options
None were requested. OP wants to copy "all files"
stuck in the VisualBasic namespace rather than the core
framework.
Only just noticed the OP cross-posted. If a VB question is posted then I
guess a VB solution can be expected to be received.
No options for recursion depth either.
Once again, not requested.
But perfect answer to the original question.
I'm glad you see it as I did.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
Jul 20 '07 #9
I used the recursive code in the xneuron link provided by Alex above.
Is simple, flexible and works perfectly.

Just added a few things like dovents and some messaging and checks. I
recommend it.
-P

Jul 20 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Antonio Lopez Arredondo | last post: by
1 post views Thread by Andrew Koenig | last post: by
3 posts views Thread by usman | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.