public function isDirectory($dirname)
    {
        $listing = $this->listDirectoryContents();

        $dirname_info = array_filter($listing, function ($item) use ($dirname) {
            return $item['type'] === 'directory' && $item['name'] === $dirname;
        });

        return count($dirname_info) !== 0;
    }