using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 更改檔名
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DirectoryInfo di = new DirectoryInfo(@"D:\test\02");
Int32 count = 1;
foreach (FileInfo fi in di.GetFiles())
{
//String NewFileName = "rico_" + count.ToString();
//重新命名
// fi.MoveTo(Path.Combine(fi.DirectoryName, fi.FullName + fi.Extension +"."+"pdf"));
fi.MoveTo(Path.Combine(fi.DirectoryName, fi.FullName +"."+"pdf"));
count++;
}
label1.Text = count.ToString()+"修改完成";
}
}
}
沒有留言:
張貼留言