How to Delete a File in C# ?

Published on June 27, 2014 by Senthil Kumar

Filed under C#

Last modified June 27, 2014

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 4 (1 votes)

This article have been viewed 15206 times

Below is a sample code snippet that demonstrates how to delete a file in C# .

How to Delete a File in C# ?

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.IO;
namespace AbundantcodeConsoleApp
    internal class Program
        private static void Main(string[] args)
           string ACFile = @"E:\input.txt";

Leave a Comment


You might be Interested in these Posts

How to read file contents from command line in Windows 10 ?

You can use the command "type" in the command line to read the contents of the text file i...

How to Copy the entire contents of a directory in C# ?

Below is a sample code snippets that demonstrates how to copy the entire contents of a directory to ...

How to replace a File extension in C# ?

If you want to replace a file extension in C# , you can use the ChangeExtension method defined in th...