473,657 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($dir Path) {
chdir($dirPath) ;
$dirPointer = opendir(".");
while (($file = readdir($dirPoi nter)) != false) {
if ($file == "." || $file == "..")
continue; // skip current and upper
directories
if (filetype($file ) == "dir") {
echo $file ."\n";
readSubdir($fil e);
} else {
// echo "file is $file\n";
} // else
} // while
closedir($dirPo inter);
chdir("..");

}

Thanks

Mar 5 '07 #1
1 1146
mj********@hotm ail.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($dir Path) {
chdir($dirPath) ;
$dirPointer = opendir(".");
while (($file = readdir($dirPoi nter)) != false) {
if ($file == "." || $file == "..")
continue; // skip current and upper
directories
if (filetype($file ) == "dir") {
echo $file ."\n";
readSubdir($fil e);
} else {
// echo "file is $file\n";
} // else
} // while
closedir($dirPo inter);
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
3908
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 subdirs. Thx, Florian
4
1887
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 number that Unix can handle in a single directory. I am using FreeBSD4.x at the moment. I am thinking the number could be as high 500,000 images in a single directory but more likely in the range of 6,000 to 30,000 for most. I did not want to...
1
376
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 saying:: Unable to find script library'/'aspnet_client\system_web\1_1_4322/WebUIValidation.js'. Try replacing this file manually or reinstall by running 'aspnet_client-regiis'. I found the file 'WebUIValidation.js' in the location...
5
5659
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 driver. I have two sql instances setup, the default instance and a named instance. On the default instance, the linked server works great no matter who is logged in using it (all authentication is NT integrated). However on the named instance only...
6
6147
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 my mappings between named colors, HEX values and the Long Integer values used in Access are not jibbing. Anyone have a nice list laying around? Danny J Lesandrini dlesandrini@hotmail.com
0
825
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 these files recursively to the project. Is there a known trick/utility to do this ?
7
5073
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 that repond to the scanner requests. I would like to know if there is a way that I can spawn a process on the server and attach it to the current thread (allow it to take control of the server requests)? Once this spawned app exits it will return...
4
1269
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> How can we achieve this functionality using XSLT. I am using xalan
5
3284
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 must build a list of those files and process them by exectuing a system command (exec?) Can some one tell me what methods to use to: a) Walk the directory tree b) execute a system command with parameters.
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.