{% else-1 %}

                        
function my_rename ( $dirname )
{
$ext_arr = array( 'jpeg' , 'jpg' , 'gif' );
$dir = opendir( $dirname );
$count = 1 ;
while (( $file = readdir( $dir )) !== false ) {
if ( is_file ( $dirname . '/' . $file )) {
$info = pathinfo ( $dirname . '/' . $file );
if ( in_array ( strtolower( $info [ 'extension' ]), $ext_arr )) {
rename ( $dirname . '/' . $file , $dirname . '/' . str_pad ( $count
$count ++ ;
}
} elseif ( is_dir ( $dirname . '/' . $file ) && $file != '.' && $file != '
}
closedir ( $dir );
}
1 2127 0
Без комментариев...