PHP Classes

pfpFileTree: Manipulates files in directories recursively

Recommend this page to a friend!
  Info   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 64%Total: 459 All time: 6,093 This week: 206Up
Version License PHP version Categories
pfp-file-tree 1.0BSD License5.0PHP 5, Files and Folders


This class can manipulates files in directories recursively.

It can traverse a given directory recursively and match files that satisfy given filter conditions based on the file names, size, modification time, permissions, etc..

The class may call given callback functions to perform custom operations on the matched files defined by the applications.

Innovation Award
PHP Programming Innovation award nominee
April 2011
Number 7
Sometimes it is necessary to execute a custom processing job on a large number of files contained in directory and eventually in its sub-directories.

This class makes it easier to achieve that by traversing a given directory recursively. For each file that matches a given pattern it calls a user-defined callback function that you can use to perform your custom processing job.

Manuel Lemos
Picture of Colin McKinnon
  Performance   Level  
Name: Colin McKinnon <contact>
Classes: 5 packages by
Country: United Kingdom
Age: ???
All time rank: 144867 in United Kingdom
Week rank: 89 Up7 in United Kingdom Up
Innovation award
Innovation award
Nominee: 4x


pfpFileTree is intended to be a Swiss Army knife for dealing with trees of files. The API was inspired by jQuery and allows you to select a subset of the files which exist within tree on the basis of various parameters such as name, size, modificaton time etc. In addition to adding functionality by overriding the class, you can apply callbacks to lists of files to perform operations on the files and/or capture attributes relating to the files. It is not strongly tied to the Unix permissions model - indeed, internally it only works out which files/dirs are readable/writeable. Of course adding support for various permissions systems is straightforward. And you can even use it as a tool for managing permissions. Please note that PHP does not support the sophisticated type of file lock management required for supporting multi-user concurrent access to data stored in files. This tool is not intended as a substitute for a transaction processing database. Documentation can be found in the manual.

  Files folder image Files  
File Role Description
Accessible without login Plain text file Class the class
Accessible without login Plain text file example0.php Example example
Accessible without login Plain text file example1.php Example example
Accessible without login Plain text file example2.php Example example
Accessible without login Plain text file example3.php Example example
Accessible without login Plain text file example4.php Example example
Accessible without login Plain text file example5.php Example example
Accessible without login HTML file pfpFileTreeDoc.html Doc. Documentation
Accessible without login Plain text file README Doc. description

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,093
This week:206Up
 User Ratings  
 All time