lovepong66
(Rugpong Sirimart (Luck))
1
I have a simple structure of folder it so simple like this
Folder
β> TEST
and the folder i had just 3 files inside image at below
so i know how to list all file inside target folder and get only filenames by using Directory.GetFiles or Path.GetFile
simple function should be like this
so the result will be like this
or if i want to show only filename i will do something like this
then result will be like this
Anyone can show me how to list all files inside folder without foreach
So, i need something easy to debug in console it very simple likeβ¦
A1.txt, A2.txt, A3.txt
HI @lovepong66
Try this Expression
String.Join(",",Directory.GetFiles("Your path"))
Regards
Sudharsan
Adding to this Checkout this Expression
String.Join(",",Directory.GetFiles(Environment.CurrentDirectory).AsEnumerable().Select(Function(s) Path.GetFileName(s.ToString)).ToArray)
Hope this Helps
Regards
Sudharsan
2 Likes
@lovepong66
In Your Case you can try this
String.Join(",",Directory.GetFiles("Your Path","*.txt").AsEnumerable().Select(Function(s) Path.GetFileName(s.ToString)).ToArray)
Regards
Sudharsan
lovepong66
(Rugpong Sirimart (Luck))
5
Nice!!! That what i think. Thanks
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.