Set the directory with your files
dataDirectory=NotebookDirectory[]<>"data";​​SetDirectory[dataDirectory];
Get the filenames
files=FileNames[All,Directory[]];
In[]:=
files
Out[]=
{/home/estevao/Desktop/teste/data/bgh.12mm15mm10nm.dat,/home/estevao/Desktop/teste/data/bgx.22mm35mm12nm.dat,/home/estevao/Desktop/teste/data/xtc.32m5km12mm.dat}
Remove the directory and extension from the filenames
In[]:=
names=StringReplace[files,(dataDirectory<>"/"|".dat")""];
Get each pattern from the filename
In[]:=
infos=StringCases[names,x:DigitCharacter..~~y:LetterCharacter..]
Out[]=
{{12mm,15mm,10nm},{22mm,35mm,12nm},{32m,5km,12mm}}
We can split the number from the unity
In[]:=
infos2=StringCases[#,{x:DigitCharacter..,y:LetterCharacter..}]&/@infos
Out[]=
{{{12,mm},{15,mm},{10,nm}},{{22,mm},{35,mm},{12,nm}},{{32,m},{5,km},{12,mm}}}
And then.. we can convert all of them
In[]:=
result=UnitConvert[Quantity[#[[1]],#[[2]]],"mm"]&/@#&/@infos2
Out[]=

12
mm
,
15
mm
,
10
1000000
mm
,
22
mm
,
35
mm
,
12
1000000
mm
,
100032
mm
,
10000005
mm
,
12
mm

You can also multiply all of them
In[]:=
Apply[Times,#]&/@result
Out[]=

101215
1000000
3
mm
,
122235
1000000
3
mm
,
100000000012325
3
mm
