Search found 7 matches

by deepsiks
Tue Feb 21, 2006 2:38 pm
Forum: PHP - Code
Topic: Directory listing script, need a little help...
Replies: 12
Views: 520

I used the above and all worked out ok. Give me a listing of $path = "path/to/dir/"; What is the best way to dive in recursively? <?php // declare array for storing directory names $dirlist = array(); // open the directory $path = "./"; function Lister($path) { if($handle = opend...
by deepsiks
Tue Feb 21, 2006 2:12 pm
Forum: PHP - Code
Topic: Directory listing script, need a little help...
Replies: 12
Views: 520

Thanks!
by deepsiks
Tue Feb 21, 2006 1:20 pm
Forum: PHP - Code
Topic: Directory listing script, need a little help...
Replies: 12
Views: 520

Thanks, used the following but it won't recursively dive into the directorys... <?php // Note that !== did not exist until 4.0.0-RC2 $dirlist = array(); function dirlisting($path) { if ($handle = opendir($path)) { /* This is the correct way to loop over the directory. */ while (false !== ($file = re...
by deepsiks
Mon Feb 20, 2006 8:22 am
Forum: PHP - Code
Topic: Directory listing script, need a little help...
Replies: 12
Views: 520

Well, I rewrote portions of the script using asort but still had no luck and just got confused (not the best at php). Here's the solution I came up with: function direcho($path) { exec("ls -R $path",$f_list); $dir_str = $path; $filelist[0] = $path; $i = 1; for ($count=0; $count<count($f_li...
by deepsiks
Sat Feb 18, 2006 8:25 am
Forum: PHP - Code
Topic: Directory listing script, need a little help...
Replies: 12
Views: 520

Thanks for the examples, they are giving me some ideas but my script gives me the output needed - except for the whole sorting thing. Is it possible to effectively patch my code to sort items or am I going to have to scrap it?
by deepsiks
Sat Feb 18, 2006 7:03 am
Forum: PHP - Code
Topic: Directory listing script, need a little help...
Replies: 12
Views: 520

Could you give me an example?
by deepsiks
Sat Feb 18, 2006 5:41 am
Forum: PHP - Code
Topic: Directory listing script, need a little help...
Replies: 12
Views: 520

Directory listing script, need a little help...

Hi all, I've been using this script with no problems but recently I was asked if I could get the listings in alphabetical order. Any easy ideas? Thanks, ds function direcho($path) {global $filetotal, $totaldirs; if ($dir = opendir($path)) {while (false !== ($file = (readdir($dir)))) { if (is_dir($pa...