日期:2014-05-16 浏览次数:20967 次
public bool DeleteDir(string strPath)
{
try
{
strPath = @strPath.Trim().ToString();
if (System.IO.Directory.Exists(strPath))
{
string[] strDirs = System.IO.Directory.GetDirectories(strPath);
string[] strFiles = System.IO.Directory.GetFiles(strPath);
foreach (string strFile in strFiles)
{
System.IO.File.Delete(strFile);
}
foreach (string strdir in strDirs)
{
System.IO.Directory.Delete(strdir, true);
}
}
return true;
}
catch (Exception Exp)
{
return false;
}
}