c# - Get all file names in a directory ignoring file extension -


i have folder files this:

foo.map foo.ind foo.dat bar.map bar.ind bar.dat readme.txt readme.html 

i distinct file names without extension, i.e. foo, bar, readme.

of course can use directory.getfiles() , make loop path.getfilenamewithoutextension() wonder if there short way, maybe 1 line, e.g. using linq?

how about:

directory     .getfiles()     .select(f => path.getfilenamewithoutextension(f.name))     .distinct(); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -