PHP code example of futape / filesystem-utility

1. Go to this page and download the library: Download futape/filesystem-utility library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

futape / filesystem-utility example snippets


use Futape\Utility\Filesyste\Paths;

echo Paths::strip('/foo/bar/baz', '/foo'); // "./bar/baz"

use Futape\Utility\Filesyste\Files;

touch('./foo');
var_dump(Files::remove('./foo')); // true

use Futape\Utility\Filesyste\FilteredDirectoryIterator;

mkdir('./foo');
touch('./foo/bar');
symlink('./foo/bar', './foo/baz');
mkdir('./foo/bam');
var_dump(
    iterator_to_array(
        (new FilteredDirectoryIterator('./foo'))
            ->setDotFiles(false)
            ->setFileTypes(FilteredDirectoryIterator::FILE_TYPE_FILE | FilteredDirectoryIterator::FILE_TYPE_DIRECTORY)
    )
); // [DirectoryIterator("./foo/bar"), DirectoryIterator("./foo/bam")]