Loosely based on Garry's Directory Listing Scrpit