PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 17th, 2004, 07:57 PM
sharyn sharyn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 32 sharyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 53 m 17 sec
Reputation Power: 5
[SOLVED] opendir() with Mac OSX

I am doing a recursive directory traversal which I originally wrote for Win XP but had to port it over to the Mac. It's not working like it did on the PC. The problem seems to be with the Opendir() function.

PHP Code:
function recursedir($BASEDIR)
      {
        
$hndl=opendir($BASEDIR);
      echo 
"recursedir : hndl = $hndl<br>";
        while(
$file=readdir($hndl)) 
        {
          if (
$file=='.' || $file=='..') continue;
          
$completepath="$BASEDIR/$file";
          if (
is_dir($completepath)) 
          {
            
# its a dir, recurse.
            
print "<font color=\"#FF0000\"> DIR: $BASEDIR/$file</font><br>\n";
            
recursedir($BASEDIR.'/'.$file);
          } 
          else
          {
            
# its a file.
            
print "FILE: $BASEDIR/$file<br>\n";
            
$FN $BASEDIR."/".$file;
            
ReadThisFile($FN);
          }
        }
      } 
//Recurse Dir 


When I echo the opendir handle on the PC I get "recursedir : hndl = Resource id # N" (N is a number), but when I do the same call on the Mac, I just get "recursedir : hndl = " and then it stops and won't recurse. Any ideas? Thanks in advance.

- sharyn

Last edited by sharyn : August 19th, 2004 at 01:09 PM. Reason: solved

Reply With Quote
  #2  
Old August 19th, 2004, 01:08 PM
sharyn sharyn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 32 sharyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 53 m 17 sec
Reputation Power: 5
ok, nevermind, the code actually works. It turns out, I was not giving it the entire path, I just started from the path the app was at (ie /Inetpub/wwwroot - or whatever the Mac path is).

- sharyn

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > opendir() with Mac OSX


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway