Function move

  • Asynchronously moves a file or directory (along with its contents).

    Requires --allow-read and --allow-write permissions.

    Parameters

    • src: string | URL

      The source file or directory as a string or URL.

    • dest: string | URL

      The destination file or directory as a string or URL.

    • Optionaloptions: MoveOptions

      Options for the move operation.

    Returns Promise<void>

    A void promise that resolves once the operation completes.

    https://docs.deno.com/runtime/manual/basics/permissions#file-system-access for more information on Deno's permissions system.

    If dest already exists and options.overwrite is false.

    If src is a sub-directory of dest.

    import { move } from "@std/fs/move";

    await move("./foo", "./bar");

    This will move the file or directory at ./foo to ./bar without overwriting.

    import { move } from "@std/fs/move";

    await move("./foo", "./bar", { overwrite: true });

    This will move the file or directory at ./foo to ./bar, overwriting ./bar if it already exists.