I asked this question yesterday with Linux, but I realized I need to get it working in both Linux and OS X. Link to earlier question: Get folder with largest number at the end of the name in Linux.
I have some folders r1, r2, r3, etc. and I want to get the name of the folder with the largest number at the end. How do I get the name?
The ls -v solution looks promising, but I want to exclude all folders that don't follow the pattern r[0-9]*