public class SimpleFileMove
{
static void Main()
{
string sourceFile = @"C:\Users\Public\public\mindstick.txt";
string destinationFile = @"C:\Users\Public\private\mindstick.txt";
// To move a file or folder to a new location:
System.IO.File.Move(sourceFile, destinationFile);
// To move an entire directory. To programmatically modify or combine
// path strings, use the System.IO.Path class.
System.IO.Directory.Move(@"C:\Users\Public\public\mindstick\", @"C:\Users\Public\private");
}
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
use following code for deleting file and directory both.