private void DeleteFolder(string dir)
{
//循环删除文件夹 foreach(string d in Directory.GetFileSystemEntries(dir))
{
if(File.Exists(d))
File.Delete(d);//直接删除其中的文件
else
DeleteFolder(d);//递归删除子文件夹
} Directory.Delete(dir);//删除已空文件夹}
{
//循环删除文件夹 foreach(string d in Directory.GetFileSystemEntries(dir))
{
if(File.Exists(d))
File.Delete(d);//直接删除其中的文件
else
DeleteFolder(d);//递归删除子文件夹
} Directory.Delete(dir);//删除已空文件夹}
请问怎样具体做到,谢谢了
{
//复制所选
string NewFolder=TxtNewFolder.Text; for (int i=0;i<DgList.Items.Count;i++)
{
if (((CheckBox)DgList.Items[i].Cells[0].FindControl("ChkSelect")).Checked)
{
string StrFullName=DgList.Items[i].Cells[3].Text;
string StrName=StrFullName.Substring(StrFullName.LastIndexOf("\\")+1);
string StrNewName=NewFolder+"\\"+StrName; if (File.Exists(StrFullName))
{
File.Copy(StrFullName,StrNewName,true);
}
else
{
DirectoryCopy(StrFullName,StrNewName,true);
}
}
} DgListBind(LblCurrPath.Text);
}---------------
核心
if (((CheckBox)DgList.Items[i].Cells[0].FindControl("ChkSelect")).Checked)
谢谢了
{
int IntId=int.Parse(DgSaledDetail.DataKeys[i].ToString());
for (int i=0;i<DgList.Items.Count;i++)
{
if (((CheckBox)DgList.Items[i].Cells[0].FindControl("ChkSelect")).Checked)
{
string StrSql="delete from where id="+IntId;
........... }
} 重新绑定;}