Skip to content

Instantly share code, notes, and snippets.

@hyzyla
Created August 3, 2026 21:14
Show Gist options
  • Select an option

  • Save hyzyla/fc577c67bdcd21f609df702c3edc90cd to your computer and use it in GitHub Desktop.

Select an option

Save hyzyla/fc577c67bdcd21f609df702c3edc90cd to your computer and use it in GitHub Desktop.
macos-copy-on-write-dir.sh
cow_clonedir() { python3 -c "import ctypes,ctypes.util,sys,os;l=ctypes.CDLL(ctypes.util.find_library('System'),use_errno=True);sys.exit(0 if l.clonefile(sys.argv[1].encode(),sys.argv[2].encode(),0)==0 else os.strerror(ctypes.get_errno()))" "$1" "$2"; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment