Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-01-09 (8 months ago) | Not enough user ratings | Total: 172 | All time: 8,817 This week: 104 |
Version | License | PHP version | Categories | |||
spl-file-find 1.1 | GNU General Publi... | 5.4 | PHP 5, Files and Folders |
Description | Author | |||
This package implements SPL iterators to find files with different criteria. Innovation Award
|
Find Large Files
I need to find large files on a server
list files and folders
list files and folders in a directory
This package provides specialized Iterator classes for finding files and directories.
include_once 'Find.php';
$path = realpath( 'YOUR_PATH' );
$find = new Find;
$files = $find->in( $path );
foreach( $files as $key => $file) {
echo '<pre> ' , $key . ' <br> ' , print_r($file, 1), '</pre>';
}
It uses template and fluent design pattern.
This is used to filter the files on the basis of extensions of the file.
$files = $find->extension(['jpg'])->in( $path );
This is used to sort the files. <br> const SORT_BY_NAME = 1 <br> const SORT_BY_NAT_NAME = 2
$files = $find->sort( 2 )->in( $path );
This is used to limit the output files.
$files = $find->limit( $offset, $limit )->in( $path );
Filter files by name
$files = $find->sortByName()->in( $path );
Filter files by natural name
$files = $find->sortByNaturalName()->in( $path );
Filter by file or directory
$files = $find->sortByType()->in( $path );
Filter files by last accessed time
$files = $find->sortByAccessedTime()->in( $path );
Filter files by last changed time
$files = $find->sortByChangedTime()->in( $path );
Filter files by last modified time
$files = $find->sortByModifiedTime()->in( $path );
Filter only files
$files = $find->onlyFiles()->in( $path );
Filter only directories
$files = $find->onlyDirectories()->in( $path );
Filter files by depth level
$files = $find->depth(0)->in( $path );
Filter files by size
$files = $find->size('>50m')->in( $path );
Released under the MIT license<br> Copyright (c) 2014 Ravi Kumar
Files (7) | / | Iterators |
File | Role | Description |
---|---|---|
ExtensionIterator.php | Class | Class source |
FileSizeIterator.php | Class | Class source |
FileTypeIterator.php | Class | Class source |
SortingIterator.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.