Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I see values in an array?
    primarykey
    data
    text
    <p>I am trying to create an a list of files within a directory, including those in subdirectories, showing their full path, filename and extension. Any guidance would be appreciated.</p> <p>After plenty of reading I have attempted several things, this is the most recent I found and tried but have not had any joy, for now I am just looking for the browser to display the above information.</p> <pre><code>$dir = '../test/images/'; function getFileList($dir, $recurse=false) { // array to hold return value $retval = array(); // add trailing slash if missing if(substr($dir, -1) != "/") $dir .= "/"; // open pointer to directory and read list of files $d = @dir($dir) or die("getFileList: Failed opening directory $dir for reading"); while(false !== ($entry = $d-&gt;read())) { // skip hidden files if($entry[0] == ".") continue; if(is_dir("$dir$entry")) { $retval[] = array( "name" =&gt; "$dir$entry/", "type" =&gt; filetype("$dir$entry"), "size" =&gt; 0, "lastmod" =&gt; filemtime("$dir$entry") ); if($recurse &amp;&amp; is_readable("$dir$entry/")) { $retval = array_merge($retval, getFileList("$dir$entry/", true)); } } elseif(is_readable("$dir$entry")) { $retval[] = array( "name" =&gt; "$dir$entry", "type" =&gt; mime_content_type("$dir$entry"), "size" =&gt; filesize("$dir$entry"), "lastmod" =&gt; filemtime("$dir$entry") ); } } $d-&gt;close(); return $retval; } print_r($retval); </code></pre> <p>My ultimate goal is to create some php that on execute will look in a directory, create the subdirectory (and any subdirectories there in) with the same name in a new directory (so /test/album/ would be created as /live/album/). Then resize any images that are contained in each original directory and save them to their related new directory. I appreciate this is a lot and will no doubt have many questions as I proceed, but will save those for later.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload