<div style="width:250px; margin:0px 0px 0px 150px; float:right;"> <asp:FileUpload ID="FileUpload1" runat="server" /> <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Save File" /> </div>
string path=Server.MapPath("filefolder/filename.extension"); if(System.IO.File.Exists(path)) { System.IO.File.Delete(path); }
string rootFolderPath = @"C:\\SomeFolder\\AnotherFolder\\FolderCOntainingThingsToDelete"; string filesToDelete = @"*DeleteMe*.doc"; // Only delete DOC files containing "DeleteMe" in their filenames string[] fileList = System.IO.Directory.GetFiles(rootFolderPath, filesToDelete); foreach(string file in fileList) { System.Diagnostics.Debug.WriteLine(file + "will be deleted"); // System.IO.File.Delete(file); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)