Loop through all the directories to rename and then rename them

@throws DoctrineStaticMetaException
973466
private function renameDirectories(): void
    {
        //update directory names and update file created paths accordingly
        foreach ($this->dirsToRename as $dirPath) {
            $updateDirPath = $this->pathHelper->renamePathBasenameSingularOrPlural(
                $dirPath,
                $this->singularNamespacedName,
                $this->pluralNamespacedName
            );
            foreach ($this->filesCreated as $k => $filePath) {
                $this->filesCreated[$k] = \str_replace($dirPath, $updateDirPath, $filePath);
            }
        }
    }
232779
protected function getProjectRootPath(): string
    {
        try {
            return Config::getProjectRootDirectory();
        } catch (\Exception $e) {
            throw new DoctrineStaticMetaException(
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
971001
def v1_folder_rename(request, response, kvlclient,
                     fid_src, fid_dest, sfid_src=None, sfid_dest=None):
    '''
    '''
    src, dest = make_path(fid_src, sfid_src), make_path(fid_dest, sfid_dest)
    new_folders(kvlclient, request).move(src, dest)
    response.status = 200
297293
public function renameFile($filename, $rename)
    {
        $this->renameDirectory($this->absolutizePath($filename), $this->absolutizePath($rename));
    }
79627
function createConfigurationDirectory()
    {
        $this->files->ensureDirExists(preg_replace('~/valet$~', '', VALET_HOME_PATH), user());

        $oldPath = posix_getpwuid(fileowner(__FILE__))['dir'].'/.valet';

        if ($this->files->isDir($oldPath)) {
            rename($oldPath, VALET_HOME_PATH);
            $this->prependPath(VALET_HOME_PATH.'/Sites');
        }

        $this->files->ensureDirExists(VALET_HOME_PATH, user());
    }
86294
def renames(from_path, to_path, user=None):
    
    to_dir = path.dirname(to_path)
    if to_dir:
        mkdir(to_dir, user=user)
    rename(from_path, to_path, user=user)
1134288
protected function cleanupDirectory()
    {
        if (empty($this->sitemapDir)) {
            throw new \Exception('Basedir not set');
        }

        $fullPath = PATH_site . '/' . $this->sitemapDir;

        if (!is_dir($fullPath)) {
            Typo3GeneralUtility::mkdir($fullPath);
        }

        foreach (new \DirectoryIterator($fullPath) as $file) {
            if ($file->isFile() && !$file->isDot()) {
                $fileName = $file->getFilename();
                unlink($fullPath . '/' . $fileName);
            }
        }
    }
548564
def rename(args):
    """"""
    old_name, new_name = args.names
    add_tags(resources.ec2.Instance(resolve_instance_id(old_name)), Name=new_name, dry_run=args.dry_run)
411105
private function updateNamespace(): void
    {
        //now path is totally sorted, update namespace based on path
        foreach ($this->filesCreated as $filePath) {
            $this->findAndReplaceHelper->setNamespaceFromPath(
                $filePath,
                $this->srcSubFolderName,
                $this->projectRootNamespace
            );
        }
    }
1321064
private function executeOnDirectories(): void
    {
        foreach ($this->config->getDirectories() as $source => $target) {
            try {
                $this->directoryExecutor->invoke($source, $target);
                $this->report->increaseParsedDirectoryNumber();
            } catch (Exception $exception) {
                $this->exceptionCatcher->catch($exception, $source);
            }
        }
    }
1130580
private function loadAll(): void
  {
    $this->findSourceFiles();
    $this->detectNameConflicts();
    $this->getColumnTypes();
    $this->readStoredRoutineMetadata();
    $this->getConstants();
    $this->getOldStoredRoutinesInfo();
    $this->getCorrectSqlMode();

    $this->loadStoredRoutines();

    // Drop obsolete stored routines.
    $this->dropObsoleteRoutines();

    // Remove metadata of stored routines that have been removed.
    $this->removeObsoleteMetadata();

    $this->io->writeln('');

    // Write the metadata to file.
    $this->writeStoredRoutineMetadata();
  }
942515
def renames(old, new):
    # type: (str, str) -> None
    """"""
    # Implementation borrowed from os.renames().
    head, tail = os.path.split(new)
    if head and tail and not os.path.exists(head):
        os.makedirs(head)

    shutil.move(old, new)

    head, tail = os.path.split(old)
    if head and tail:
        try:
            os.removedirs(head)
        except OSError:
            pass
33308
private function renameSplitFiles()
    {
        $c = 1;
        $wholeFile = new File($this->getArchivePath());

        foreach ($this->getSplitFiles() as $file/* @var $file SplFileInfo */) {
            $new_filename = sprintf("%s/%spart%s.%s",
                $wholeFile->getPath(),
                basename($wholeFile->getFilename(), $wholeFile->getExtension()),
                $c++,
                $wholeFile->getExtension()
            );

            rename($file->getRealPath(), $new_filename);
        }
    }
179083
@Override
  public boolean rename(Path src, Path dst) throws IOException {
    // Even though the underlying GCSFS will also throw an IAE if src is root, since our filesystem
    // root happens to equal the global root, we want to explicitly check it here since derived
    // classes may not have filesystem roots equal to the global root.
    if (src.makeQualified(this).equals(getFileSystemRoot())) {
      logger.atFine().log("GHFS.rename: src is root: '%s'", src);
      return false;
    }

    long startTime = System.nanoTime();
    Preconditions.checkArgument(src != null, "src must not be null");
    Preconditions.checkArgument(dst != null, "dst must not be null");

    checkOpen();

    URI srcPath = getGcsPath(src);
    URI dstPath = getGcsPath(dst);
    logger.atFine().log("GHFS.rename: %s -> %s", src, dst);

    try {
      getGcsFs().rename(srcPath, dstPath);
    } catch (IOException e) {
      // Occasionally log exceptions that have a cause at info level,
      // because they could surface real issues and help with troubleshooting
      (logger.atFine().isEnabled() || e.getCause() == null
              ? logger.atFine()
              : logger.atInfo().atMostEvery(5, TimeUnit.MINUTES))
          .withCause(e)
          .log("Failed GHFS.rename: %s -> %s", src, dst);
      return false;
    }

    long duration = System.nanoTime() - startTime;
    increment(Counter.RENAME);
    increment(Counter.RENAME_TIME, duration);
    return true;
  }
237546
public function copyTemplateDirectoryAndGetPath(
        string $pathToProjectRoot,
        string $templatePath,
        string $destPath
    ): string {
        $realTemplatePath = realpath($templatePath);
        if (false === $realTemplatePath) {
            throw new DoctrineStaticMetaException('path ' . $templatePath . ' does not exist');
        }

        $relativeDestPath = $this->filesystem->makePathRelative($destPath, $pathToProjectRoot);
        $subDirectories   = explode('/', $relativeDestPath);
        $path             = $this->createSubDirectoriesAndGetPath($pathToProjectRoot, $subDirectories);
        $this->filesystem->mirror($realTemplatePath, $path);
        $this->fileCreationTransaction::setPathCreated($path);

        return $path;
    }
129139
def rename(self, src_basename, dest_basename, datadir="outdir"):
        
        directory = {
            "indir": self.indir,
            "outdir": self.outdir,
            "tmpdir": self.tmpdir,
        }[datadir]

        src = directory.path_in(src_basename)
        dest = directory.path_in(dest_basename)

        os.rename(src, dest)
735217
def rename(self, newpath):
        ""
        # POST https://www.jottacloud.com/jfs/**USERNAME**/Jotta/Sync/Ny%20mappe?mvDir=/**USERNAME**/Jotta/Sync/testFolder
        #url = '%s?mvDir=/%s%s' % (self.path, self.jfs.username, newpath)
        params = {'mvDir':'/%s%s' % (self.jfs.username, newpath)}
        r = self.jfs.post(self.path,
                          extra_headers={'Content-Type':'application/octet-stream'},
                          params=params)
        return r