If you start with readdir ( http://php.net/manual/en/function.readdir.php ) which will list the files then you should be able to get a list of files, then you need to check the size of each file - have a go and see how far you get.