I am writing some little script that assembles backup data into one directory. The directory content will then be uploaded to a cloud service and after that we can remove it. I was wondering how one could utilize APFS' copy-on-write feature with a command like cp
in Terminal.
The Finder does a great job. But if I run cp Largefile LargeFileCopy
it takes forever to copy the file and also uses the space accordingly.
I found it myself.
On macOS,
cp
supports the-c
option.cp -c Largefile LargeFileCopy
will then use the new clonefile(2) library and immediately return without using any additional space on the device.