sort your images and video

usage of scandir() instead of opendir()[...]