728x90

using System.Collections.Generic;

using System.IO;

using System.Text.RegularExpressions;

 

namespace TEST

{

    class Function

    {

        public static List<string> GetImageFiles(string directoryPath)

        {

            List<string> imageFileList = new List<string>();

 

            foreach (string fileName in Directory.GetFiles(directoryPath))

            {

                if (Regex.IsMatch(fileName, @".jpg|.png|.bmp|.JPG|.PNG|.BMP|.JPEG|.jpeg$"))

                {

                    imageFileList.Add(fileName);

                }

            }

 

            return imageFileList;

        }

    }

}

 

 

728x90
Posted by kjun.kr
,