Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find and list all files/folders in a folder in Haxe

Tags:

haxe

This question is in principal the same like these ones here

  • How to read all files in a folder from Java?
  • How do I list all files of a directory?
  • ...

But is there a way to do the same in on sys target platforms in Haxe, without running ls / dir via sys.io.Process and parsing the results?

like image 300
quant Avatar asked Dec 14 '22 17:12

quant


1 Answers

Yes, you can use sys.FileSystem.readDirectory(path) for this.

Returns the names of all files and directories in the directory specified by path.

If path does not denote a valid directory, an exception is thrown.

If path is null, the result is unspecified.

If you need files to be listed recursively, this article from the Haxe Code Cookbook is a good reference (there's a section titled "Recursive loop through all directories / files").

like image 51
Gama11 Avatar answered Mar 31 '23 21:03

Gama11