You're right. This went through several iterations, one of which was using the permissions part to filter out folders before `grep -v /$` was used instead. Fixed.