728x90
728x170

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
,