System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex(@"\d{10}.");
string sNewFileName = rgx.Replace(str_文件路径,".");
if (System.IO.File.Exists(System.IO.Path.GetFullPath(sNewFileName)))
{
//MessageBox.Show("当前路径已经存在,需要先进行删除!");
System.IO.File.Delete(System.IO.Path.GetFullPath(sNewFileName));
}
try{
System.IO.FileInfo fi = new System.IO.FileInfo(str_文件路径);
fi.MoveTo(System.IO.Path.Combine(str_文件路径.Substring(0,str_文件路径.LastIndexOf('\\')-1),sNewFileName));
return sNewFileName;
}
catch(System.Exception exp){
//MessageBox.Show(exp.ToString());
return str_文件路径;
}
string sNewFileName = rgx.Replace(str_文件路径,".");
if (System.IO.File.Exists(System.IO.Path.GetFullPath(sNewFileName)))
{
//MessageBox.Show("当前路径已经存在,需要先进行删除!");
System.IO.File.Delete(System.IO.Path.GetFullPath(sNewFileName));
}
try{
System.IO.FileInfo fi = new System.IO.FileInfo(str_文件路径);
fi.MoveTo(System.IO.Path.Combine(str_文件路径.Substring(0,str_文件路径.LastIndexOf('\\')-1),sNewFileName));
return sNewFileName;
}
catch(System.Exception exp){
//MessageBox.Show(exp.ToString());
return str_文件路径;
}