I want not scan all the files in a directory and its sub-directory. And get their path in an array. Like path to the file in the directory in array will be just
path -> text.txt
while the path to a file in sub-directory will be
somedirectory/text.txt
I am able to scan single directory, but it returns all the files and sub-directories without any ways to differentiate.
    if ($handle = opendir('fonts/')) {
    /* This is the correct way to loop over the directory. */
    while (false !== ($entry = readdir($handle))) {
        echo "$entry<br/>";
    }
    closedir($handle);
    }
What is the best way to get all the files in the directory and sub-directory with its path?
 
     
     
    