How to access all filenames in a directory

I want to prompt the user to select a directory upon what the app would copy all the filenames in the user’s clipboard. I tried to access the filenames with a couple custom extensions, but neither returned anything. For each of them, I’ve tried multiple paths and checked whether the file/directory existed and whether it was writable. For example SAF:


When run, returns this

And when doing this (Shared scope is the only thing that returns something):


I get files and directories from across my entire device, not only from the given directory.

I’ve tried these as well, in vain:
file:///storage/emulated/0/folder
/storage/emulated/0/folder
folder

I made my best to look up for multiple extensions and their documentation, as well as other posts, without success.

What am I doing wrong?

These directories can only be accessed by SAF now.

I think you are not aware of SAF workflow.
You can find some examples here: