[php:1:be3b1fe5da]<pre><?php
/**
* Miracle Renamer System 0.0.0.1 ALPHA
* Katalog, w ktorym sa pliki musi miec uprawniania 0777
**/
#sciezka do plikow, musi konczyc sie znakiem: /
$path = $_SERVER['DOCUMENT_ROOT'] . '/szablon.com/';
#rozszerzenia, ktore nalezy wziasc pod uwage
$exts = array(
'html', 'htm', 'rar', 'tar.gz', 'zip', 'php', 'php3', 'm', 'css'
);
$exts = implode( '|', $exts );
$rexp = '/(.+?).(' . $exts . ')/i';
$handle = dir( $path );
$handle->read();
$handle->read();
$files = array();
while ( FALSE !== ( $file = $handle->read() ) )
{
if ( !( is_dir( $path . $file ) ) )
{
$files[] = $file;
}
}
foreach ( $files AS $key => $value )
{
preg_match( $rexp, $value, $matches );
print rename( $path . $value, $path . $matches[1] ) . "n";
}
?></pre>[/php:1:be3b1fe5da]