How do I get the folder name from my path?
This is the file path:
@"C:\Users\ME\Desktop\videos"
Under the main path there's a folder that I want to get the name:
@"C:\Users\ME\Desktop\videos\sample2"
@"C:\Users\ME\Desktop\videos\sample3"
@"C:\Users\ME\Desktop\videos\sample4"
Under the sample folder, there are videos that I want to get the name:
@"C:\Users\ME\Desktop\videos\sample1\video1.mp4
This is my code:
foreach(string s in Directory.GetFiles(@"C:\Users\ME\Desktop\videos").Select(Path.GetFileName))
{
MessageBox.Show(s);
}
Is this possible? How do I get the name of every file that exists inside my video/main folder using only the main path?