如何重命名文件 [英] how can rename files

查看:91
本文介绍了如何重命名文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含图像的文件夹,该如何重命名图像,从0到图像数量,如何循环重命名图像

i have folder that contain images how can i rename images From 0 to the number of images ,how can i do loop to rename images

推荐答案

DirectoryInfo d = new DirectoryInfo(@"E:\Images\");
FileInfo[] infos = d.GetFiles("*");
int i = 0;
foreach (FileInfo f in infos)
{
    i = i + 1;
    File.Move(f.FullName, Path.Combine(f.Directory.ToString(), Convert.ToString(i)) + f.Extension);
}


DirectoryInfo di = new DirectoryInfo("Folder_of_interest");

foreach (FileInfo fi in di.GetFiles())
{
    fi.MoveTo("new_file_name");
}



那应该让您开始.



That should get you started.


在程序提取视频中,对保存在文件夹中的帧进行修整,然后在保存后如何刷新文件夹,我想以数字顺序重命名这些帧. 谢谢
in the programe extract vedio to frams the frames saved in folder how refresh folder after saving and i want to rename the frames with numer order .
thanks


这篇关于如何重命名文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆