What shell command will clone a directory instead of making a deep copy?
I wish to take an APFS clone snapshot of a large directory using a shell script. In Finder, I can just Cmd-C, move to the other folder, and Cmd-V and within a few seconds I have a duplicate that takes little extra disk space. Using the cp shell command, it takes ages and creates a copy that takes up disk space. What shell command can duplicate a folder "instantly" the same way Finder can?
The cp command now takes the option -c
to create copy on write clones of files.
From the cp man file:
-c copy files using clonefile(2)
For example: cp -c my-file my-file-clone