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"

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

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

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



//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)){
$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>


Return current item: Batch File Rename - BFR library