Fix recursive issue ( -r flag )
This commit is contained in:
parent
ca3291bcb6
commit
10c48da98a
@ -49,16 +49,14 @@ function getFileList ( $dir ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDirList ( $dir ) {
|
function getDirList ( $dir ) {
|
||||||
$dirList = array();
|
$dirList = array();
|
||||||
$iterator = new DirectoryIterator ( getDirName ( $dir ) ) ;
|
$iterator = new DirectoryIterator ( getDirName ( $dir ) ) ;
|
||||||
foreach ( $iterator as $fileinfo ) {
|
foreach ( $iterator as $fileinfo ) {
|
||||||
if ( $fileinfo->isDir() ) {
|
if ( $fileinfo->isDir() && !$fileinfo->isDot()) {
|
||||||
$dirList[] = $fileinfo->getFilename();
|
$dirList[] = $fileinfo->getFilename();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Chop dir "." and ".."
|
|
||||||
array_shift ( $dirList ) ;
|
|
||||||
array_shift ( $dirList ) ;
|
|
||||||
return $dirList;
|
return $dirList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +204,7 @@ foreach ( $searchDirs as $dir ) {
|
|||||||
}
|
}
|
||||||
if( $matches[2][0] != $newName ) {
|
if( $matches[2][0] != $newName ) {
|
||||||
if( $test ) {
|
if( $test ) {
|
||||||
echo "File \"{$matches[2][0]}\" will renamed to \"$newName\"\n";
|
echo "File \"{$matches[2][0]}\" will be renamed to \"$newName\"\n";
|
||||||
} else {
|
} else {
|
||||||
rename ( $file, "{$matches[1][0]}$newName" );
|
rename ( $file, "{$matches[1][0]}$newName" );
|
||||||
}
|
}
|
||||||
@ -225,4 +223,4 @@ if ( $test ) echo "*** Test enabled ***\n\n";
|
|||||||
|
|
||||||
|
|
||||||
//------- End Operations -------*/
|
//------- End Operations -------*/
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user