Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How To Read a Directory One Entry at a Time
How To Read a Directory One Entry at a Time? - PHP Script Tips - Working with Directoris and Files
✍: FYIcenter.com
If you want to read a directory one entry at a time, you can use opendir() to open the specified directory to create a directory handle, then use readdir() to read the directory contents through the directory handle one entry at a time. readdir() returns the current entry located by the directory pointer and moves the pointer to the next entry. When end of directory is reached, readdir() returns Boolean false. Here is a PHP script example on how to use opendir() and readdir():
<?php mkdir("/temp/download"); $array["one"] = "Download PHP scripts at dev.fyicenter.com.\r\n"; $array["two"] = "Download Perl scripts at dev.fyicenter.com.\r\n"; $bytes = file_put_contents("/temp/download/todo.txt", $array); print("List of files:\n"); $dir = opendir("/temp/download"); while ( ($file=readdir($dir)) !== false ) { print("$file\n"); } closedir($dir); ?>
This script will print:
List of files: . .. todo.txt
2007-04-23, 4571👍, 0💬
Popular Posts:
.NET INTERVIEW QUESTIONS - What is Suspend and Resume in Threading ? It is Similar to Sleep and Inte...
What is Windows DNA architecture? Note :- If you have worked with classic ASP this question can come...
How To Run Stored Procedures in Debug Mode? - Oracle DBA FAQ - Introduction to Oracle SQL Developer ...
.NET INTERVIEW QUESTIONS - Can we use events with threading ? Yes, you can use events with thread; t...
How to create a thread in a program? You have two ways to do so. First, making your class "extends" ...