PHP批量重命名

function AutoRenameFolder($dir) {
    foreach (glob($dir . '/*') as $k => $v) {
        if (is_file($v)) {
            rename($v, sprintf('%s/%s.%s', dirname($v), substr(1001 + $k, 1), strtolower(pathinfo($v, PATHINFO_EXTENSION))));
        }
        if (is_dir($v)) {
            AutoRenameFolder($v);
        }
    }
}

function main() {
    $path = __DIR__;
    AutoRenameFolder($path);
}

main();