How to get a file full path in c# with Path.GetFullPath -


i trying full path file name only. have tried use :

string fullpath = path.getfullpath("exceltest"); 

but returns me incorrect path (something project path).

i have read somewhere here comment says following:

        var dir = environment.specialfolder.programfilesx86;         var path = path.combine(dir.tostring(), "exceltest.csv"); 

but not know file saved , therefore not know environment.

can me how full path of file name?

i guess you're trying find file (like in windows search), right ?

i'd this question - find files has string in filename, , there can return full filepath.

var filelist = new directoryinfo(@"c:\").getfiles("*exceltest*", searchoption.alldirectories); 

and use foreach manipulations, e.g.

foreach(string file in filelist) { // messagebox.show(file); } 

Comments