var Path = @"F:\教程\ASP\第12季asp.net高级\";//文件夹路径
DirectoryInfo dir = new DirectoryInfo(Path);
if (dir.Exists)
{
FileInfo[] fiList = dir.GetFiles();
foreach (var item in fiList)
{
var FilePath = item.FullName; //路径加文件名加后缀
//var FileName = item.Name; //文件名加后缀
string s2 = FilePath.Substring(0, 24) + FilePath.Substring(46);
MessageBox.Show(s2);
//File.Move(FilePath,s2); //更改名称
}
}
时间: 2024-10-26 01:11:26