method delete documentation in bbn\File\Dir

Deletes the given directory and all its content.

Example

\bbn\X::dump(\bbn\File\Dir::delete('/home/Docs/Test/') // (bool) true \bbn\X::dump(\bbn\File\Dir::delete('/home/Docs/Test', 0); // (bool) false \bbn\X::dump(\bbn\File\Dir::delete('/home/Docs/Test/file.txt'); // (bool) false function(string $dir, bool $full = true) { $dir = self::clean($dir); if ( is_dir($dir) ){ $files = self::getFiles($dir, 1, 1); foreach ( $files as $file ){ self::delete($file); } if ( $full ){ return rmdir($dir); } return true; } if ( is_file($dir) ){ return unlink($dir); } return false; }

Deletes the given directory and all its content. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.