.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> C# >> Post New Resource Bookmark and Share   

 Subscribe to Articles

delete files base on character using C#.net

Posted By:Narayanan       Posted Date: April 11, 2012    Points: 25    Category: C#    URL: http://www.dotnetspark.com  

Here , Delete file base on user specify character using C#.net
 

 
   private void deletefilescheckwithstartingword(string inputPath,char ch)
        {
            
            string[] InputPath = System.IO.Directory.GetFiles(inputPath);
            foreach (string fileName in InputPath)
            {
                FileInfo fileInformation = new FileInfo(fileName);
                string file = fileInformation.Name;
                char[] letter = file.ToCharArray();
                if (letter[0] == ch)
                {
                    System.IO.File.Delete(fileName);
                }
            }
        }
 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend