How to get/print all max-nested non-empty subdirs starting from path(dir)?

I found a random option to do this on Linux (bash):

find ~/.config/nvim -type f |
sed 's%/[^/]*$%%' |
sort -u

But I'm looking for an os-universal neovim solution on Lua (maybe so that it would be possible to print such subdirs in a for loop)

  • Is there something about neovim's Lua interface that makes this neovim-specific? I suspect this is just a general programming question, but I may have misunderstood.
    – D. Ben Knoble
    Feb 12 at 13:03


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.