# 2.6.1.1 Creation and Removal

typedef uint32_t ZixCopyOptions

  Bitwise OR of `ZixCopyOptions` values.

enum ZixCopyOption

  Options to control filesystem copy operations.

  enumerator ZIX_COPY_OPTION_NONE

    Report any error.

  enumerator ZIX_COPY_OPTION_OVERWRITE_EXISTING

    Replace existing file.

ZixStatus zix_copy_file(ZixAllocator *allocator, const char *src, const char *dst, ZixCopyOptions options)

  Copy the file at path `src` to path `dst`.

  If supported by the system, a lightweight copy will be made to take advantage of copy-on-write support in the filesystem. Otherwise, a simple deep copy will be made.

  Parameters:

    - allocator – Allocator used for a memory block for copying if necessary.

    - src – Path to source file to copy.

    - dst – Path to destination file to create.

    - options – Options to control the kind of copy and error conditions.

  Returns:

    `ZixStatus.ZIX_STATUS_SUCCESS` if `dst` was successfully created, or an error.

ZixStatus zix_create_directories(ZixAllocator *allocator, const char *dir_path)

  Create the directory `dir_path` and any parent directories if necessary.

  Parameters:

    - allocator – Allocator used for a temporary path buffer if necessary.

    - dir_path – The path to the deepest directory to create.

  Returns:

    `ZixStatus.ZIX_STATUS_SUCCESS` if all directories in `dir_path` were successfully created (or already existed), or an error.

ZixStatus zix_create_directory(const char *dir_path)

  Create the directory `dir_path` with all available permissions.

  Returns:

    `ZixStatus.ZIX_STATUS_SUCCESS` if `dir_path` was successfully created, or an error.

ZixStatus zix_create_directory_like(const char *dir_path, const char *existing_path)

  Create the directory `dir_path` with the permissions of another.

  This is like `zix_create_directory()`, but will copy the permissions from another directory.

  Returns:

    `ZixStatus.ZIX_STATUS_SUCCESS` if `dir_path` was successfully created, or an error.

ZixStatus zix_create_directory_symlink(const char *target_path, const char *link_path)

  Create a symbolic link at `link_path` that points to `target_path`.

  This is a separate function from `zix_create_symlink()` because some systems (like Windows) require directory symlinks to be created specially.

  Returns:

    `ZixStatus.ZIX_STATUS_SUCCESS`, or an error.

ZixStatus zix_create_hard_link(const char *target_path, const char *link_path)

  Create a hard link at `link_path` that points to `target_path`.

  Returns:

    `ZixStatus.ZIX_STATUS_SUCCESS`, or an error.

ZixStatus zix_create_symlink(const char *target_path, const char *link_path)

  Create a symbolic link at `link_path` that points to `target_path`.

  Note that portable code should use `zix_create_directory_symlink()` if the target is a directory, since this function won’t work for that on some systems (like Windows).

  Returns:

    `ZixStatus.ZIX_STATUS_SUCCESS`, or an error.

char *zix_create_temporary_directory(ZixAllocator *allocator, const char *path_pattern)

  Create a unique temporary directory at a given path pattern.

  The last six characters of `pattern` must be “XXXXXX” and will be replaced with unique characters in the result.

  Parameters:

    - allocator – Allocator used for the returned path.

    - path_pattern – A path pattern ending in “XXXXXX”.

  Returns:

    The path of the created directory, or null.

ZixStatus zix_remove(const char *path)

  Remove the file or empty directory at `path`.