繁体   English   中英

与FILE.MOVE结合使用

[英]FOR EACH combined with FILE.MOVE

我想创建一个简单的程序,该程序可以访问文件夹中的所有文件,所有文件均为同一文件类型,然后对每个文件使用a重命名所有文件。 新名称为IMG ###,其中###为增量名称。 我知道该怎么做。 我如何引用在使用的所有图像for each

例:

For Each X in Folder {
    rename stuff here for x
 }

我需要知道的是如何在x位置引用文件。

您可以按照以下思路进行处理:

var files = Directory.GetFiles(path, "*.", SearchOption.AllDirectories);

foreach (string item in files)
{
    //You can rename by moving the files into their 'new names'. 
    //The names are full paths
    File.Move(oldName, newName);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM