src/ZendMover/Mover.php
private function prepareFilePathTo(\SplFileInfo $file)
    {
        if ($this->currentCommand->isUsePathReplace()) {

            $fileWhereToMovePath = $file->getPath() . DIRECTORY_SEPARATOR;

            if ($this->direction === self::DIRECTION_FORWARD) {
                $filePathTo = $this->currentCommand->replacePath($fileWhereToMovePath);
            } elseif ($this->direction === self::DIRECTION_BACK) {
                $filePathTo = $this->currentCommand->replacePathBack($fileWhereToMovePath);
            } else {
                throw new \Exception(__METHOD__ . " wrong direction");
            }

            //fuck
            $this->currentCommand->setToDirectory($filePathTo);
        } else {
            $filePathTo = $this->currentCommand->getToDirectory();
        }

        if (!file_exists($filePathTo) && !is_dir($filePathTo)) {
            mkdir($filePathTo, $this->defaultDirMod, TRUE);
        } else {
            chmod($filePathTo, $this->defaultDirMod);
        }

        if ($this->currentCommand->getDestinationFileName()) {
            $fileName = $this->currentCommand->getDestinationFileName();
        } else {
            $fileName = $file->getFilename();
        }

        $filePathTo .= $fileName;

        return $filePathTo;
    }
private function prepareFilePathTo(\SplFileInfo $file)
    {
        if ($this->currentCommand->isUsePathReplace()) {

            $fileWhereToMovePath = $file->getPath() . DIRECTORY_SEPARATOR;

            if ($this->direction === self::DIRECTION_FORWARD) {
                $filePathTo = $this->currentCommand->replacePath($fileWhereToMovePath);
            } elseif ($this->direction === self::DIRECTION_BACK) {
                $filePathTo = $this->currentCommand->replacePathBack($fileWhereToMovePath);
            } else {
                throw new \Exception(__METHOD__ . " wrong direction");
            }

            //fuck
            $this->currentCommand->setToDirectory($filePathTo);
        } else {
            $filePathTo = $this->currentCommand->getToDirectory();
        }

        if (!file_exists($filePathTo) && !is_dir($filePathTo)) {
            mkdir($filePathTo, $this->defaultDirMod, TRUE);
        } else {
            chmod($filePathTo, $this->defaultDirMod);
        }

        if ($this->currentCommand->getDestinationFileName()) {
            $fileName = $this->currentCommand->getDestinationFileName();
        } else {
            $fileName = $file->getFilename();
        }

        $filePathTo .= $fileName;

        return $filePathTo;
    }
if to directory not exists

@param \SplFileInfo $file
@return mixed
@throws \Exception