PHP code example of totem / files-renamer

1. Go to this page and download the library: Download totem/files-renamer 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/ */

    

totem / files-renamer example snippets


// We want to delete numbers from the file names.
$renamer = new FilesRenamer(
	__DIR__ . '/files',
	function ($fileName) {
		return preg_replace('/\d*/', '', $fileName);
	}
);

// We will also rename the files in the subdirectories.
$renamer->setRecursiveMode(true);

// We will first test if the result is correct.
$renamer->setDebugMode(true);

$renamer->run();

php composer.phar