.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 >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

The job about forder and file

Posted By: wolf     Posted Date: October 28, 2011    Points:5   Category :C#
Hi all

1:have a forder A ,some file in this forder and the forder B ,a same to A.
2:must delete file in forder B by A. delete:(if the file exist in forder B which the file in forder A.must delete the file in forder B )
3:In the job, i don't know how to use ArrayList in C#. I'm first do the job about the C#, I'm job about the java befor now. so want some help.the valus in the list .but i can't get it to use.
4:how to delete file in C#.

thanks all to help me do this job. your have something out this job,must tell me.

Responses
Author: Narayanan             
Posted Date: January 03, 2012     Points: 20   

Hi,

Delete a file:
      public void DeleteFiles(String Path, String fileType)
{
string[] files = Directory.GetFiles(Path, fileType);
foreach (string file in files)
{
File.Delete(file);
}


}

Call like this,
 DeleteFiles("Specify Path","Particular File Type");

eg:
if you want to delete a bmp file in a NewFolder in the E Disk.
DeleteFiles("E:\\NewFolder\\","*.bmp");


Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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