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
반응형

+ Recent posts