Skip to content

Instantly share code, notes, and snippets.

@openroomxyz
Last active April 23, 2020 16:51
Show Gist options
  • Save openroomxyz/42621294a478ef2ffbb10487f5469961 to your computer and use it in GitHub Desktop.
Save openroomxyz/42621294a478ef2ffbb10487f5469961 to your computer and use it in GitHub Desktop.
Unity : How to get a list of path -s to all files (only files excluding sub folders ) in some folder?
private static List<string> GetListOfFilesInFolder(string path)
{
string[] fileEntries = System.IO.Directory.GetFiles(path);
List<string> result = new List<string>();
foreach(string f in fileEntries)
{
if(System.IO.File.Exists(f))
{
result.Add(f);
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment