华为手机拍摄的视频默认名称是“VID_20231213_111723”,图片名称是“IMG_20231213_111723”,需要批量将“VID”改为“IMG”
代码(C#):
```csharp
StringBuilder sb=new StringBuilder();
DirectoryInfo TheFolder = new DirectoryInfo(folderFullName);
foreach (FileInfo NextFile in TheFolder.GetFiles())
{
string str ;
string a,b;
this.listBox2.Items.Add(NextFile.Name);
str = NextFile.Name.ToString();
a = str.Substring(0, 3);
if (a == "VID")
{
b = str.Replace("VID", "IMG");
System.IO.File.Move(str,b);//更换名称
}
}
```
简单理解:读取原名称,判断前三个字符为"VID",若是,更换为“IMG”即可