lib/Util/Filesystem/Directory.php
public function moveChildren($targetDir)
    {
        $info = new \SplFileInfo($targetDir);

        if (!$info->isDir())
        {
            throw new InvalidArgumentException(sprintf('Target dir not found'));
        }

        if (!$info->isReadable())
        {
            throw new InvalidArgumentException(sprintf('Target dir not readable'));
        }

        if (!$info->isWritable())
        {
            throw new InvalidArgumentException(sprintf('Target dir not writable'));
        }

        foreach (new \DirectoryIterator($this->dir) as $info)
        {
            if ($info->isDot())
            {
                continue;
            }

            $sourcePathname = $info->getPathname();
            $subdirPathname = $this->subtractBasedir($sourcePathname, $this->dir);
            $targetPathname = sprintf('%s/%s', $targetDir, $subdirPathname);
            rename($sourcePathname, $targetPathname);
        }
    }
public function moveChildren($targetDir)
    {
        $info = new \SplFileInfo($targetDir);

        if (!$info->isDir())
        {
            throw new InvalidArgumentException(sprintf('Target dir not found'));
        }

        if (!$info->isReadable())
        {
            throw new InvalidArgumentException(sprintf('Target dir not readable'));
        }

        if (!$info->isWritable())
        {
            throw new InvalidArgumentException(sprintf('Target dir not writable'));
        }

        foreach (new \DirectoryIterator($this->dir) as $info)
        {
            if ($info->isDot())
            {
                continue;
            }

            $sourcePathname = $info->getPathname();
            $subdirPathname = $this->subtractBasedir($sourcePathname, $this->dir);
            $targetPathname = sprintf('%s/%s', $targetDir, $subdirPathname);
            rename($sourcePathname, $targetPathname);
        }
    }
public function moveChildren ( $ targetDir ) { $ info = new \ SplFileInfo ( $ targetDir ) ; if ( ! $ info -> isDir ( ) ) { throw new InvalidArgumentException ( sprintf ( 'Target dir not found' ) ) ; } if ( ! $ info -> isReadable ( ) ) { throw new InvalidArgumentException ( sprintf ( 'Target dir not readable' ) ) ; } if ( ! $ info -> isWritable ( ) ) { throw new InvalidArgumentException ( sprintf ( 'Target dir not writable' ) ) ; } foreach ( new \ DirectoryIterator ( $ this -> dir ) as $ info ) { if ( $ info -> isDot ( ) ) { continue ; } $ sourcePathname = $ info -> getPathname ( ) ; $ subdirPathname = $ this -> subtractBasedir ( $ sourcePathname , $ this -> dir ) ; $ targetPathname = sprintf ( '%s/%s' , $ targetDir , $ subdirPathname ) ; rename ( $ sourcePathname , $ targetPathname ) ; } }
Move the children of this directory into targetDir

@param string $targetDir Target directory pathname

@return void
Move the children of this directory into targetDir