Voting

: max(five, two)?
(Example: nine)

The Note You're Voting On

Morteza
15 years ago
This code renames all files and folders in a specific directory to lower case:

<?php
$path
= "my_doc";

function
getDirectory( $path = '.', $level = 0 ){

$ignore = array( 'cgi-bin', '.', '..' );

$dh = @opendir( $path );

while(
false !== ( $file = readdir( $dh ) ) )
{
if( !
in_array( $file, $ignore ) )
{
$spaces = str_repeat( '&nbsp;', ( $level * 4 ) );
if(
is_dir( "$path/$file" ) )
{
echo
"<strong>$spaces $file</strong><br />";
rename($path."\\".$file, strtolower($path."\\".$file));
getDirectory( "$path/$file", ($level+1) );

}
else {
echo
"$spaces $file<br />";
rename($path."\\".$file, strtolower($path."\\".$file));
}
}
}
closedir( $dh );
}

getDirectory( $path , 0 )

?>

<< Back to user notes page

To Top