PHP
  Home arrow PHP arrow Finding Paths, Timestamps and More wit...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2006-09-18

    Table of Contents:
  • Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP
  • Learning the rewind(), current() and valid() methods
  • Using the getFileName() and isFile() methods
  • Using the getMTime(), getATime(), and getCTime() methods
  • Using the getPath() and getPathName() methods

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Finding Paths, Timestamps and More with the DirectoryIterator Class in PHP


    (Page 1 of 5 )

    Are you interested in having at your disposal a quick reference for working with the “DirectoryIterator” class that comes with PHP 5? Then this might be the article that you’ve been waiting for! Welcome to the second tutorial of the series “A Close Look at the DirectoryIterator Class in PHP 5.” Over the course of this set of installments, you’ll find complete coverage of the most important methods bundled with this class, and learn how to take advantage of their excellent functionality.

    Introduction

    If you’ve read the previous article, you probably have a better idea now of how the “DirectoryIterator” class does its business. As you’ll certainly remember, all the code samples that were shown in that article were aimed at demonstrating how easy this class makes it to traverse a specified directory.

    Having at hand such a useful piece of code, there’s no need to create custom classes to deal with the contents of any directory, since the mentioned class can traverse a directory by using a regular “foreach” loop. In addition, the class on its own comes packaged with a bunch of handy methods which can be used for moving the iterator’s pointer back and forward,  as well as obtaining complete information on the size, type, paths, etc. of the files contained within the selected directory.

    If the wealth of impressive features exposed by this class isn’t enough for you, I have still more material to show you in the next few lines. Now that I have your attention, in this second part of the series I’ll continue exploring new methods that come with the “DirectoryIterator” class, including those that use additional capabilities to determine the full path and name of directory elements, their modification timestamps, and much more.

    Having established the goals of this article, it’s time to jump forward and keep learning more about the “DirectoryIterator” class. Let’s get going!

    More PHP Articles
    More By Alejandro Gervasio


       · Over this second part of the series, you'll learn a few more useful methods that are...
     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





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