I am saving the file using this Method-
public void SaveDialog(string template, string visatypeid, string folderName, string fileType)
{
string filePath = Server.MapPath("" + folderName + "/" + visatypeid + "/" + fileType + "/" + template + "");
System.IO.FileInfo targetFile = new System.IO.FileInfo(filePath);
FileInfo objFileInfo = default(FileInfo);
try
{
objFileInfo = new FileInfo(filePath);
if (objFileInfo.Exists)
{
Response.Clear();
Response.Cache.SetCacheability(System.Web.HttpCacheability.Private);
Response.AddHeader("Content-Disposition", "attachment; filename=" + objFileInfo.Name);
Response.AddHeader("Content-Length", objFileInfo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(filePath);
Response.End();
}
else
{
Type cstype = this.GetType();
ClientScriptManager cs = Page.ClientScript;
cs.RegisterStartupScript(cstype, "onLoadCall", "", false);
}
}
catch (Exception ex)
{
//MsgBox("error")
}
}
File Is Saving like that--Casefile/608/Document/file.txt Formate.
Now,i have to delete the subfolder menas--608/Document/File.txt
Anyone have a idea about how to do it?
File Is Saving like that--Casefile/608/Document/file.txt Formate.
Now,i have to delete the subfolder menas--608/Document/File.txt
Anyone have a idea about how to do it?

Ruchi HPosted Jul 29, 2013, 7:40 AM
Please check here
http://stackoverflow.com/questions/1288718/how-to-delete-all-files-and-folders-in-a-directory
http://stackoverflow.com/questions/12297024/how-to-delete-all-files-from-specific-folder
Abhineet SrivastavaPosted Jul 29, 2013, 11:09 AM
Thanks all for your quick reply
Iftikar HussainPosted Jul 29, 2013, 8:11 AM
Try like this
Regards,
Iftikar
Sanjeeb LenkaPosted Jul 29, 2013, 7:53 AM
Posted Jul 29, 2013, 7:45 AM
dir.Delete(true);
WHen you pass true, it will delete the sub-folder contents also.