Click here to Skip to main content
15,885,900 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need to know how to copy, paste, delete files in c sharp via the GUI (form), I need an example or guidance to do so. It is for Windows Explorer that I'm building. In advance thank you very much.
Posted
Comments
ZurdoDev 25-Apr-13 15:03pm    
Have you looked at the File object, in System.File?

using System.IO;

string file = "C:\\Program Files\\Cortex\\Log\\Backup.log";
string filecp = "C:\\Program Files\\Cortex\\Log\\Backup_copy.log";

void Delete()
{
   if (!File.Exists(file))
      File.Delete(file);
}

void Copy()
{
   if (!File.Exists(file))
      File.Copy(file, filecp);
}
 
Share this answer
 
The short answer should be enough: http://msdn.microsoft.com/en-us/library/system.io.file.aspx[^].

More importantly, Microsoft Q209354.

—SA
 
Share this answer
 
Comments
Espen Harlinn 25-Apr-13 19:18pm    
5'ed!
Sergey Alexandrovich Kryukov 25-Apr-13 19:42pm    
Thank you, Espen.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900