1. Go to this page and download the library: Download fzed51/console-fs 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/ */
fzed51 / console-fs example snippets
Directory::create('nom_nouveau_dossier'); // new Directory('nom_nouveau_dossier')
Directory::delete('nom_dossier');
Directory::delete('nom_dossier', true);
Directory::exist('nom_dossier') // true|false;
$dir = new Directory('./chemin/nom_dossier');
$dir->getName(); // "nom_dossier"
$dir = new Directory('./chemin/nom_dossier');
$dir->getFullName(); // "c:/chemin_absolut/chemin/nom_dossier"
$dir = new Directory('./chemin/nom_dossier');
$dir->empty(); // true|false
$dir = new Directory('./chemin/nom_dossier');
$dir->copy('destination') // new Directory('destination')
File::create('nom_fichier'); // new File('mon_fichier')
File::delete('nom_fichier');
File::exist('nom_fichier') // true|false;
$file = new File('./chemin/nom_fichier.ext');
$file->getName(); // "nom_fichier.ext"
$file = new File('./chemin/nom_fichier.ext');
$file->getFullName(); // "c:/chemin_absolut/chemin/nom_fichier.ext"
$file = new File('./chemin/nom_fichier.ext');
$file->copy('directory_destination') // new File('./directory_destination/nom_fichier.ext')
$file->copy('nouveau/nom/') // new File('./nouveau/nom/nom_fichier.ext')
$file->copy('nouveau/nom') // new File('./nouveau/nom')
$file->copy('directory_destination/nouveau_nom.ext') // new File('./directory_destination/nouveau_nom.ext')