added option to append trailing slashes on get_subdirectories()