You are here: Re: Cant process subdirs named with numbers?? « PHP Programming Language « IT news, forums, messages
Re: Cant process subdirs named with numbers??

Posted by Hendri Kurniawan on 03/05/07 23:58

mjstenberg@hotmail.com wrote:
> Im using a batch process function but found PHP to behave very
> strangely: It only reads subdirs that have caharacters in their names.
> Im having subdirs with integer names (0, 1, 2, 3.. ) but this script
> does not read them at all?! Can someone tell me how to get around
> this?
> function readSubdir($dirPath) {
>
>
> chdir($dirPath);
> $dirPointer = opendir(".");
> while (($file = readdir($dirPointer)) != false) {
> if ($file == "." || $file == "..")
> continue; // skip current and upper
> directories
> if (filetype($file) == "dir") {
> echo $file ."\n";
> readSubdir($file);
> } else {
> // echo "file is $file\n";
> } // else
> } // while
> closedir($dirPointer);
> chdir("..");
>
> }
>
> Thanks
>

Works fine under my computer.
BTW there is a function called is_dir that checks whether or not
the string is a directory. IMHO better compatibility.

Hendri

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация