private function checkFolder(string $path, string $folder, bool $create = false) : bool
    {
        $retval = false;

        $target = $path . (is_string($folder) && strlen($folder) > 0 ? DIRECTORY_SEPARATOR . $folder : '');
        echo "    ... checking folder $target ...";

        if (is_dir($target)) {
            echo "EXISTS\n";
            $retval = true;
        } elseif ($create) {
            if ($retval = mkdir($target)) {
                echo "CREATED\n";
            } else {
                echo "ERROR\n";
            }
        } else {
            echo "NOT PRESENT\n";
        }

        return $retval;
    }
private function checkFolder(string $path, string $folder, bool $create = false) : bool
    {
        $retval = false;

        $target = $path . (is_string($folder) && strlen($folder) > 0 ? DIRECTORY_SEPARATOR . $folder : '');
        echo "    ... checking folder $target ...";

        if (is_dir($target)) {
            echo "EXISTS\n";
            $retval = true;
        } elseif ($create) {
            if ($retval = mkdir($target)) {
                echo "CREATED\n";
            } else {
                echo "ERROR\n";
            }
        } else {
            echo "NOT PRESENT\n";
        }

        return $retval;
    }
private function checkFolder ( string $ path , string $ folder , bool $ create = false ) : bool { $ retval = false ; $ target = $ path . ( is_string ( $ folder ) && strlen ( $ folder ) > 0 ? DIRECTORY_SEPARATOR . $ folder : '' ) ; echo "    ... checking folder $target ..." ; if ( is_dir ( $ target ) ) { echo "EXISTS\n" ; $ retval = true ; } elseif ( $ create ) { if ( $ retval = mkdir ( $ target ) ) { echo "CREATED\n" ; } else { echo "ERROR\n" ; } } else { echo "NOT PRESENT\n" ; } return $ retval ; }
Check if a folder exists inside a path.
@param string $path Base path to check folder.
@param string $folder Folder to be checked.
@param bool $create If true creates the folder if not exists.
@return bool Returns true if success. In case of creation of folder, returns false if folder cannot be created.
Check if a folder exists inside a path .