protected function createFolder($folderPath)
    {
        if(!@mkdir($folderPath,0777,true) && !is_dir($folderPath))
        {
            throw new FileSystemException(
                new Phrase('Folder can not be created, but does not exist.')
            );
        }     
        
        return $this;
    }
protected function createFolder($folderPath)
    {
        if(!@mkdir($folderPath,0777,true) && !is_dir($folderPath))
        {
            throw new FileSystemException(
                new Phrase('Folder can not be created, but does not exist.')
            );
        }     
        
        return $this;
    }
protected function createFolder ( $ folderPath ) { if ( ! @ mkdir ( $ folderPath , 0777 , true ) && ! is_dir ( $ folderPath ) ) { throw new FileSystemException ( new Phrase ( 'Folder can not be created, but does not exist.' ) ) ; } return $ this ; }
Create a folder path, if folder does not exist

@param $folderPath
@return $this
@throws \Magento\Framework\Exception\FileSystemException
Create a folder path if folder does not exist