2

how can I copy files from folder to another when by using c#?

kartal
  • 17,436
  • 34
  • 100
  • 145

3 Answers3

8

Here is a good example from MSDN:

How to: Copy, Delete, and Move Files and Folders (C# Programming Guide)

Mr.Expert
  • 466
  • 2
  • 3
2

The System.IO.File, System.IO.Directory, System.IO.FileInfo classes "Mr.Expert" suggested above are fine for copying and deleting individual files.

But if you are deleting/copying large number of files you are probably better off using an alternative method see this question I asked previous..

Delete a large number (>100K) of files with c# whilst maintaining performance in a web application?

The System.IO.Directory.GetFiles can cause a performance issue when dealing with large number of files.

Community
  • 1
  • 1
Aim Kai
  • 2,934
  • 1
  • 22
  • 34
1
System.IO.File.Copy
allonym
  • 1,408
  • 10
  • 18