My game allows custom level creation with a menu to access the locally-saved user-created levels. These levels are saved using Native.FileUtils
. Is there some way to get how many files are in any folder foo
?
You can simply use fileUtils.listFiles(folder).length
to get number of files in a folder. But the answer maybe not you want, you will get a string[] of file names when use listFIles(), write your own rule to count fileNum.
let folder = "xxx";
let files = f.listFiles(folder);
let fileNum = files.length;