Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transfer files in using c#

Tags:

c#

file

copy

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

like image 414
kartal Avatar asked Jan 29 '26 16:01

kartal


2 Answers

Here is a good example from MSDN:

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

like image 127
Mr.Expert Avatar answered Jan 31 '26 06:01

Mr.Expert


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.

like image 37
Aim Kai Avatar answered Jan 31 '26 04:01

Aim Kai