Wednesday, October 4, 2017

Get the file Name From the Folder in C#

Get the file Name From the Folder in C#


                folderPath = "E:\\video-app\\SamplePics";// Here you can set your folder path (SamplePics contain lot of images i want image name one by one) and show it in messagebox
     
            foreach (var file in Directory.GetFiles(folderPath))
            {
                string[] pathArr = file.Split('\\');
                string[] fileArr = pathArr.Last().Split('.');
                string fileName = fileArr.First().ToString();
                MessageBox.Show("" + fileName);

            }



No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...