Location: PHPKode > projects > Batch File Rename - BFR library > php-bfr.v1.5/simple_demo.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <title>Batch File Rename (BFR) Simple Demo </title>
  <link rel="stylesheet" href="media/style.css" type="text/css" />
</head>

<div id="header">Batch File Rename (BFR) Simple Demo</div>
&nbsp; <a href="doc">see documentation</a>
<br /><br />

<body>

<?php

//include class file
require_once ("class.bfr.php");

$rename = new BFR($debug = true, $debug_file = true);

//setting work directory (the path must end with "/")
if(!$rename->setDir('/path/to/directory/', true)){
 die();
}
$rename->setExt("#f|php|html|doc"); //setting allowed file extensions . "#f" : indicates to directories. "# : indicates to all file types"

$rename_options = array(
// 'before' => 'before-name ', //text before filename
// 'after' => ' after-name', //text after filename
 'chext' => 'doc', //change file extension
 'capitalize' => true, //capitalize filename
 'underscore-space' => true //convert underscores to spaces
);

$rename->setRenameOpt($rename_options); //setting rename options

$rename->process(); //start renaming

?>
<hr align="center" size="1" color="#C3C3C3" />
<i>Mohamed ELkholy (<a href="mailto:hide@address.com">hide@address.com</a>)</i>

</body>

</html>
Return current item: Batch File Rename - BFR library