namespace _06_Teste { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void cmdValidar_Click(object sender, EventArgs e) { foreach (String file in Directory.GetFiles("c:\\ImgRoute\\Caixa9 D1\\", "*.*")) { FileInfo fileName = new FileInfo(file); string imag = fileName.Name; if (imag.Length == 16) { //("Numero do auto correto"); } else { //("Numero do auto invalido"); } } } }