So I am trying to build a Button
which is able to change the name of a file. In this case the files are images and what I want to do is remove what's before and including underscore. I was able to do it by simply using strings:
string a = "truck_0001";
string b = a.Substring(a.IndexOf("_") + 1);
label1.Text = b;
But now, I want to use it to remove something from a file name:
string caminho = @"C:\Users\Administrator\Desktop\Teste\";
DirectoryInfo dir = new DirectoryInfo(caminho);
FileInfo[] fi = dir.GetFiles("*.ico");
foreach (var f in fi)
{
}
Could you help me applying that on the name of the file?