'File.Copy files with the same name

I have folder with houndreds of files, and I need a button that will copy files with the same name to another folder. Files will have names like:

XXXXXXX.Something.45235234234.tif

XXXXXXX.Something.5345345.tif

YYYYYYY.Something.34634734.tif

YYYYYYY.Something.354245234.tif

ZZZZZZZ.Something.452356456234234.tif

ZZZZZZZ.Something.867895856.tif

So the first click of a buton will copy XXXXXXX files, second click YYYYYYY etc. All files i need to copy will be in alphabetical order, and X,Y,Z will be always numbers. Is this even posible with File.Copy? I have button like below, but it copy all the files from folder.

public void button2_Click(object sender, EventArgs e)
    {
        
        string startFodler = $@"C:\Users\Mkzz\Desktop\doki";
        string destinyFodler = @"C:\Users\Mkzz\Desktop\doki\Test1\";

        string[] files = Directory.GetFiles(startFodler, "*.tif");

        pictureBox1.Dispose();
        listView1.Dispose();
        
        foreach (string f in files)
        {
            string fName = f.Substring(startFodler.Length +1);
            File.Copy(Path.Combine(startFodler, fName), Path.Combine(destinyFodler, fName), true);

        }
        foreach (string f in files)
        {
            File.Delete(f);
        }
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source