UltraMega Blog

Working With Directories in PHP

PHP offers some built in file system related functions that allow you to work directly with files and directories. This tutorial will focus on working with directories. It will explain how to open and list the contents of directories, which is actually pretty easy to do.

The process goes pretty much like this: open a directory, read the directory in a loop, check each entry to see if it is a file or directory, display each accordingly, then close the directory.