Svetlitski / fcp

A significantly faster alternative to the classic Unix cp(1) command, copying large files and directories in a fraction of the time.
BSD 3-Clause "New" or "Revised" License
734 stars 17 forks source link

[Feature] Support clonefile(2) on macOS #36

Open zachriggle opened 1 year ago

zachriggle commented 1 year ago

fcp is an awesome project, and amazingly fast.

However, it could be even faster if it used the clonefile(2) syscall on macOS. This is instantaneous and creates a copy-on-write file backed by the same filesystem blocks as the original. For copies that do not cross onto different filesystems / devices, this is effectively identical to a manual copy, while being O(1) instead of O(n).

Rendered man page here: https://www.manpagez.com/man/2/clonefile/ Raw man page here: https://opensource.apple.com/source/xnu/xnu-3789.21.4/bsd/man/man2/clonefile.2.auto.html