C#:Getting all image files in folder
Posted
by Meko
on Stack Overflow
See other posts from Stack Overflow
or by Meko
Published on 2010-06-01T20:54:15Z
Indexed on
2010/06/01
21:03 UTC
Read the original article
Hit count: 130
c#
Hi all. I am trying to get all images from folder but ,this folder also include sub folders. like /photos/person1/ and /photos/person2/ .I can get photos in folder like
path= System.IO.Directory.GetCurrentDirectory() + "/photo/" + groupNO + "/";
public List<String> GetImagesPath(String folderName)
{
DirectoryInfo Folder;
FileInfo[] Images;
Folder = new DirectoryInfo(folderName);
Images = Folder.GetFiles();
List<String> imagesList = new List<String>();
for (int i = 0; i < Images.Length; i++)
{
imagesList.Add(String.Format(@"{0}/{1}", folderName, Images[i].Name));
// Console.WriteLine(String.Format(@"{0}/{1}", folderName, Images[i].Name));
}
return imagesList;
}
But how can I get all photos in all sub folders? I mean I want to get all photos in /photo/ directory at once.
© Stack Overflow or respective owner