diff --git a/tosfs/core.py b/tosfs/core.py index d63a3af..4f9e474 100644 --- a/tosfs/core.py +++ b/tosfs/core.py @@ -204,7 +204,29 @@ def info( return self._try_dir_info(bucket, key, path, fullpath) def rmdir(self, path: str) -> None: - """Remove a directory, if empty.""" + """ + Remove a directory if it is empty. + + Parameters + ---------- + path : str + The path of the directory to remove. The path should be in the format + `tos://bucket_name/directory_path`. + + Raises + ------ + FileNotFoundError + If the directory does not exist. + NotADirectoryError + If the path is not a directory. + TosfsError + If the directory is not empty or if there is an error during the removal process. + + Examples + -------- + >>> fs = TosFileSystem() + >>> fs.rmdir("tos://mybucket/mydir/") + """ path = self._strip_protocol(path).rstrip("/") + "/" bucket, key, _ = self._split_path(path) if not key: