Read Files from a specific folder

I was wondering if you guys could help me with this bit of code. I’m supposed to create a code that reads files from a folder and outputs them in the game. I’m supposed to use a for loop that cycles through the decks and I’m supposed to use debug.log to output the names.


private function GetDeck()

Deck = new Array();

var info = new DirectoryInfo(Application.dataPath+"/Deck");
var fileInfo = info.GetFiles();
for (file in fileInfo)
{
	Deck.Push(new Deck(file.Name,file.FullName));
}

private function LoadDeck()

I’m not sure how to go about this so any help would be appreciated.

This may help: Directory.EnumerateFiles Method (System.IO) | Microsoft Learn