Get directory contents using βπ filesπ
joeskeen opened this issue Β· comments
βοΈ Proposed change
Introduce a new method for getting a list of files in a given directory.
Parameters:
- directoryPathπ‘
Returns:
π¨ππ‘π
π€ Rationale
The π can do the following:
- create directory
- delete file
- delete directory (empty or non-empty)
- create symbolic link
- test for file existence (optionally checking for read, write, execute)
- get file size
- resolve absolute path
Yet there is no way to determine what files and/or folders exist in a folder without knowing their names.
πΊ Example
πππ π€~π€ β β‘οΈ dirContents
π item dirContents π
π item β
π
Outputs something like:
Documents
Downloads
Pictures
Videos
Do you see this as recursively searching, or just finding the top files in the directory?
I was thinking the equivalent of readdir in NodeJS, which just does one level deep. If we had that, we could implement our own recursive operation, but right now it's just not possible with the files package.
I agree this would be very useful. Feel free to open a pull request.