PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Copy all files from a folder to another folder, recursively

 
 
pamela fluente
Guest
Posts: n/a
 
      19th Jul 2007

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

 
Reply With Quote
 
 
 
 
Alex Meleta
Guest
Posts: n/a
 
      19th Jul 2007
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



pf> What is the most current (for framework 2.0) and easy way to copy
pf> recursively
pf> all files from folder "Folder1" to folder "Folder2" ?
pf> Is there any simple function in the framework to do that?
pf>
pf> -P
pf>


 
Reply With Quote
 
 
 
 
Bob Johnson
Guest
Posts: n/a
 
      19th Jul 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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
>



 
Reply With Quote
 
Joergen Bech
Guest
Posts: n/a
 
      19th Jul 2007

Google:
http://vbcity.com/forums/topic.asp?tid=19980
http://vbcity.com/forums/faq.asp?fid=15&cat=System
http://www.dotnet247.com/247referenc...45/225766.aspx
http://www.dotnet247.com/247referenc.../16/83818.aspx
http://cyrilgupta.com/blog/?p=84
http://www.bubble-media.com/cgi-bin/...es/000026.html

etc etc etc.

All of them suggest writing a recursive method or going
to the Win32 API.

You might want to consider if it should be possible to cancel
the operation, how the function should perform/react when
encountering large files (e.g. DVD ISO images), .lnk "folders",
large collections of files, etc. Perhaps perform the operation
on a separate thread in order not to lock up your interface for
the (unknown) duration of the recursive copy/move.

Regards,

Joergen Bech



On Thu, 19 Jul 2007 08:20:12 -0700, pamela fluente
<(E-Mail Removed)> 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


 
Reply With Quote
 
zacks@construction-imaging.com
Guest
Posts: n/a
 
      19th Jul 2007
On Jul 19, 11:20 am, pamela fluente <pamelaflue...@libero.it> 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


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!)


 
Reply With Quote
 
pamela fluente
Guest
Posts: n/a
 
      19th Jul 2007
On 19 Lug, 18:06, Alex Meleta <amel...@gmail.com> wrote:
> 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
>
> pf> What is the most current (for framework 2.0) and easy way to copy
> pf> recursively
> pf> all files from folder "Folder1" to folder "Folder2" ?
> pf> Is there any simple function in the framework to do that?
> pf>
> pf> -P
> pf>


Thanks. Very nice.

 
Reply With Quote
 
Ben Voigt [C++ MVP]
Guest
Posts: n/a
 
      19th Jul 2007

"pamela fluente" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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/library/system.io.directory(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
>



 
Reply With Quote
 
ShaneO
Guest
Posts: n/a
 
      20th Jul 2007
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.
 
Reply With Quote
 
Joergen Bech
Guest
Posts: n/a
 
      20th Jul 2007
On Fri, 20 Jul 2007 10:04:39 +1000, ShaneO <(E-Mail Removed)>
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



 
Reply With Quote
 
ShaneO
Guest
Posts: n/a
 
      20th Jul 2007
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy all files from a folder to another folder, recursively pamela fluente Microsoft C# .NET 10 20th Jul 2007 06:04 PM
How to recursively clear all the filters applied to a folder Jean-Marc MOLINA Microsoft Outlook 1 30th Mar 2006 03:05 PM
Recursively Set All Folders & Files to NOT Read-Only melo Microsoft C# .NET 2 9th Mar 2005 01:27 AM
howto recursively copy a folder ? Antonio Lopez Arredondo Microsoft Dot NET 1 5th Dec 2003 03:02 PM
howto recursively copy a folder ? Antonio Lopez Arredondo Microsoft Dot NET 0 4th Dec 2003 06:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:30 PM.