473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Cant process subdirs named with numbers??

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

Mar 5 '07 #1
1 1124
mj********@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
Mar 6 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Florian Lindner | last post by:
Hello, how can I get all subdirectories of a given directory. os.listdir(dir) doesn't differentiate between directories and files, os.walk seems to me a bit overkill since it also descends in the...
4
by: David Pratt | last post by:
Hi. I am creating a python application that uses PIL to generate thumbnails and sized images. It is beginning to look the volume of images will be large. This has got me to thinking. Is there a...
1
by: pmud | last post by:
In my ASP.Net application I added a required field validator.Before adding this , my application was running fine but after ading this, when i tried to view the .aspx in browser, i got an alert msg...
5
by: grondaia | last post by:
Here's my situation: I have an ODBC DSN setup for Timberline Data (An accounting package that uses pervasive.sql) on my sql box. I set up a linked server using the supplied timberline odbc...
6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
0
by: Neil | last post by:
I have an existing code base that I want to import into VS 7.1 C++. It has 200+ include files in 20+ subdirs. e.g. incl/package/classfile.h incl/package2/classfile2.h I want to add all of...
7
by: Devron Blatchford | last post by:
Hi there, I am trying to develop a small menu application to run on an RF network, we are using a wavelink server to communicate with our rf scanners and run VB.NET applications on our server...
4
by: Ankush | last post by:
Hi, I want to process numbers in a different fashion: My input is something like: <A>Ankush 123 Singhal 23 man</A> I want output as: <Doc>Ankush <num>123</num> Singhal <num>23> man</Doc> ...
5
by: KraftDiner | last post by:
Hi I need help writing a python script that traverses (recursivly) a directory and its sub directories and processes all files in the directory. So at each directory if there are files in it I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.