public function copyPath($from, $to, $replace = true, $purge = true)
    {
        if (false === file_exists($from)) {
            throw FileSystemException::invalidPath($from);
        }

        if (is_dir($from)) {
            if (false === file_exists($to)) {
                if (false === @ mkdir($to)) {
                    throw FileSystemException::lastError(
                        $to,
                        "The directory \"$to\" could not be created: "
                    );
                }
            }

            if (false === ($dh = @ opendir($from))) {
                throw FileSystemException::lastError(
                    $to,
                    "The directory \"$from\" could not be opened: "
                );
            }

            while (false !== ($item = readdir($dh))) {
                if (('.' === $item) || ('..' === $item)) {
                    continue;
                }

                $this->copyPath(
                    $from . DIRECTORY_SEPARATOR . $item,
                    $to . DIRECTORY_SEPARATOR . $item,
                    $replace,
                    false
                );
            }

            closedir($dh);
        } elseif (false === (file_exists($to) && (false === $replace))) {
            if (false === @ copy($from, $to)) {
                throw FileSystemException::lastError($to);
            }
        }

        if ($purge) {
            $this->purgePaths[] = $to;
        }
    }