In PHP, it is possible to get a list of files and folders and save them into an array: PHP: List files in a directory . Building on this, I have added recursion to the dirList function detailed in the aforementioned link: /** * Return a list of all files within a directory * * @param string $directory The directory to search * @param bool $recursive Go through child directories as well * @return array */ function dirList($directory, $recursive = true) { // create an array to hold directory list $results = array(); // create a handler for the directory $handler = opendir($directory); // keep going until all files in directory have been read while (false !== ($file = readdir($handler))) { // if $file isn't this directory or its parent, // add it to the results array if ($file != '.' && $file != '..') { // if the file is a directory // add contents of that directory if(is_dir($directory.DIRECTORY_SEPARATOR.$file) && $recurs...