So the answer to your first question is to change from a file.path.includes(...) to an equality check, like file.folder == dv.current().file.folder
I don’t quite get what you want out of your second question, could you examplify it some more?
Would the it answer your question, to enter the generic code into a dv.view() script, like if you added the following code into vault/js/listAllFiles.js:
I misread parts of your request, and file.folder is not available in your current context. What’s available is file.parent.path, and that is the folder of the current file. Some further testing indicates that there is a slight difference when handling the root folder as the file.parent.path then becomes /, but the dv.current().file.folder becomes empty.
With that taken into account try this one to list all files in the current directory: