Question: Using bash on macos I can create COW file clones with `cp -c`. Is there a Python library that provides the same functionality? The copy functions in shutil doesn't seem to mention cloning.

On APFS clones: <https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/APFS_Guide/Features/Features.html>

On BSD clonefile: <http://www.manpagez.com/man/2/clonefile/>

Answer: 
The Python standard library does not support cloning files.

To clone a file using `cp -c` in a subprocess you can use this function:

```
def clonefile(source, dest):
    subprocess.check_output(["cp", "-c", source, dest])

```
Ok, I marked this as a duplicate but didn't know the difference between copying and cloning.

This is the location of the instructions for copying files with as much detail as possible in Python:
<https://docs.python.org/3.6/library/shutil.html>

It starts with the following warning:
**Warning Even the higher-level file copying functions (shutil.copy(), shutil.copy2()) cannot copy all file metadata.**

If what you want is an OS cloning of the file, you're going to need to run a system call. That system call is going to need to be OS specific, and the call will be pulled from this question:
[Calling an external command in Python](https://stackoverflow.com/questions/89228/calling-an-external-command-in-python)

So, look into the copy library and see if you can get enough detail, and if you can't use a system-specific call.