Try a regex:
(?<FromVer>\d(\.\d)?)_V_(?<ToVer>\d(\.\d)?)$
Should do it.
If you want to restrict numbers to just 1 to 7, then replace "\d" with "[1-7]" throughout.
"what is regex? i m not aware of this . i want the code for the above mentioned problem since am very new to c#"
"Regex" is short for "Regular Expression Parser" and it is a tool for extracting "bits" of information from a string. In this case, it does some simple pattern matching and gets the info you want from the path string.
Get a copy of
Expresso[
^] - it's free, and it examines and generates Regular expressions.
It also generates C# code for you!
public static Regex findVersions = new Regex("(?<FromVer>[1-7](\\.\\d)?)_V_(?<ToVer>\\d(\\.\\d)?)$");
...
Match m = findVersions.Match(filepath);
if (m.Success)
{
string fromVer = m.Groups["FromVer"].Value;
string toVer = m.Groups["ToVer"].Value;
...
}