标签:批量 textbox spl bsp each file str string object
private void button1_Click(object sender, EventArgs e) { string directoryName = textBox1.Text.Trim(); //文件夹路径 string[] files = Directory.GetFiles(directoryName); foreach (string sDirectory in files) { string fileName = Path.GetFileName(sDirectory); //旧文件名 string newFileName = fileName.Split(‘_‘)[2]; //新文件名 string sNewDirectory = Path.Combine(directoryName, newFileName); //文件夹路径+新文件名 Directory.Move(sDirectory, sNewDirectory); } }
标签:批量 textbox spl bsp each file str string object
原文地址:https://www.cnblogs.com/eryuanch/p/10398528.html