Get an array of all files in a directory structure

Recently I had need of a function to scan through all directories under a given directory root and return an array of all the files found. Simple you may think, that is what scandir is for. And you would be correct, apart from the fact that I was writing this to be compatible back to PHP4.4.9.

So here, for your pleasure, I present a simple bit of code to produce a flat array of all files under a given directory tree.

Feel free to fork and edit to your hearts content.

This post has been viewed 871 times.

Leave a Reply

Your email address will not be published. Required fields are marked *