如何批量删除文件后辍名为.TZ的文件 如何批量删除文件后辍名为.TZ的文件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string[] strFiles = System.IO.Directory.GetFiles("c:\\","*.tz"); foreach(string file in strFiles) { System.IO.File.Delete(file); } /**** 根据查找指定路径下的所有.TZ结尾的文件后删除* ***/DirectoryInfo dir = new DirectoryInfo("Path");//Path :要查找文件的路径FileInfo[] e = dir.GetFiles("*.TZ");foreach (FileInfo file in e){ file.Delete();} 我只知道这个方法了~不知道对你有没有帮助~ 批量,注意是运行时的路径,或者使用绝对路径,调试时候路径和真正执行时的路径不一样。Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.Start(); p.StandardInput.WriteLine("del *.tz"); ASP.NET分页 日历控件Calendar中判断day和week的方法 关于c#的一个很简单的问题,望高手予以解答! c#问题 修改新闻时,显示内容有多余字符,提交出错. 请教一个C#代码超时则自动停止的问题 crystalreport载入图片的问题 有关定时服务的问题 日期减去天数得到一个新的日期怎么做 vs2010打包,系统必备组件添加问题 如何实现gridview单击某一行链接到相关网页 控制gridview的列宽,十万火急!
foreach(string file in strFiles)
{
System.IO.File.Delete(file);
}
* 根据查找指定路径下的所有.TZ结尾的文件后删除
* ***/
DirectoryInfo dir = new DirectoryInfo("Path");//Path :要查找文件的路径
FileInfo[] e = dir.GetFiles("*.TZ");
foreach (FileInfo file in e)
{
file.Delete();
} 我只知道这个方法了~不知道对你有没有帮助~
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true; p.Start();
p.StandardInput.WriteLine("del *.tz");