betty.os module

Provide OS interaction utilities.

async betty.os.copy_tree(source_directory_path: Path, destination_directory_path: Path, *, file_callback: Callable[[Path], Awaitable[Any]] | None = None) None[source]

Recursively copy all files in a source directory to a destination.

Create a hard link to a source path, or copy it to its destination otherwise.

For most purposes, Betty requires files to be accessible at certain paths, rather than that these paths provide unique files. Therefore, the fastest thing to do is create hard links. In case that fails, such as when the source and destination are on different disks, copy the file instead. You SHOULD NOT use this function if the destination file will be modified afterwards.

If the destination exists, it will be left untouched.