Change file extension

Dear All,
I have to open two files that have the same name, but different extension.
In the same directory I have one binary file (i.e test.bin) and one text file (i.e. test.txt).
I use this string to open the bin file

NAME = SystemDialogInput["FileOpen"];

Now Name is C://path//test.bin

Is there the possibility to define in an automatic way

NAME2=C://path//test.txt

Thank you very much and best regards

Dear all,
I found the solution by myself. I used this construct:

NAME2 = FileNameJoin[{DirectoryName[NAME], 
    F = FileBaseName[NAME] <> ".txt"}];

Maybe it can help. Best regards.

Assuming those are the only two files in that directory with the name “test”

{name1, name2} = Filenames["test.*", "C://path"]

Bruno,

here is one handy way to select txt-files using SystemDialogInput:

(* specific directory, e.g. home directory: *)
dir = $HomeDirectory;
filename=SystemDialogInput["FileOpen", {dir, {"Text-Data" -> {"*.txt"}, "Simply Everything" -> {"*"}}}]