If the file name is always in this format, you can do something crude like this:
string filename = @"D:\toto\food\Cloture_490001_10_01_2013.pdf"; string date = filename.Substring(filename.Length - 14, 10);
This will get a substring of 10_01_2013.pdf with a length of 14 characters, but will only take the first 10 characters, leaving you with 10_01_2013 .
If, however, the file name is in a different format, and the date may appear anywhere inside the name, you can consider something like Regular Expressions to be able to match for ##_##_#### and pull it out.
source share