Hi,
Let’s see a simple example of deleting a file in a folder using c#.
using System; using System.IO; public class MainClass { static void Main( string [] args) { FileInfo sampleFile= new FileInfo( @"c:SamplestestFile.txt" ); sampleFile.Create(); sampleFile.Delete(); } } |
sampleFile.Create() will create the file in the specified folder.
sampleFile.Delete() will delete the file in the specified folder.
Thank you so much for this post. It is really quite frustrating sometimes on how to manage and how to delete file