using System; using Microsoft.VisualBasic.FileIO;
namespace leaver { class Program { static void Main(string[] args) { Console.WriteLine("删除文件到回收站"); string filepath = "leaver.txt"; FileSystem.DeleteFile(filepath, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin); Console.WriteLine("删除文件完成");//keleyi.com Console.WriteLine("删除文件夹到回收站"); string dirpath = "leaver"; FileSystem.DeleteDirectory(dirpath, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin); Console.WriteLine("删除文件夹完成"); } } }
Austin Liu 刘恒辉
Project Manager and Software Designer E-Mail:lzhdim@163.com Blog:https://lzhdim.cnblogs.com 欢迎收藏和转载此博客中的博文,但是请注明出处,给笔者一个与大家交流的空间。谢谢大家。 |