Search recursively for media files. Refactor the readDir function for more general use.