Skip to content

Path.rmdir() method

pathlib-ts > Path > rmdir

Remove this directory; the directory must already be empty.

Signature:

rmdir(): Promise<void>;

Returns:

Promise<void>

Promise that settles once the directory is removed.

Uses Node’s fs.rmdir to mirror CPython semantics.

Removing staging directories asynchronously

import { Path } from "pathlib-ts";
const staging = new Path("./build/staging");
await staging.rmdir();