static void Main(string[] args) { FileExplorerModel explorer = new FileExplorerModel("d:\\recycle.bin"); List <FileSystemInfo> fileList = explorer.GetFileList(); if (fileList == null) { return; } foreach (FileSystemInfo info in fileList) { if (info.Name.Equals("a.txt") && info is FileInfo) { try { explorer.RenameTo(info as FileInfo, "a.reg"); } catch (FileAlreadyExistException e) { Console.Error.WriteLine(e.Message); } } Console.WriteLine(info.FullName); } }
public ActionResult Delete() { string filePath = Request.Form["filePath"].ToString(); try { FileExplorerModel.DeleteFromDisk(filePath, false); } catch (Exception e) { return(Json(new ResultMessage(1, e.Message))); } return(Json(new ResultMessage())); }
static void Main(string[] args) { FileExplorerModel explorer = new FileExplorerModel("d:\\"); }
static void Main(string[] args) { FileExplorerModel model = new FileExplorerModel("c:\\"); FileExplorerModel.DeleteFromDisk("c:\\a.cfg", false); }