Skip to content

Instantly share code, notes, and snippets.

@dgentry
Created July 23, 2020 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgentry/90f6c4389ea7ea0b1007f07dc7136882 to your computer and use it in GitHub Desktop.
Save dgentry/90f6c4389ea7ea0b1007f07dc7136882 to your computer and use it in GitHub Desktop.
Recursively remove all weird Apple filesystem flags, xattrs, and ACLs that would keep you from deleting your files
#!/bin/bash
# Take care to run only from the directory you want to delete, not the parent
find -L . -flags +uchg -exec chflags -h nouchg {} \;
find -L . -flags +schg -exec chflags -h noschg {} \;
chmod -RN .
find . -type l -exec chmod -h -N {} \;
xattr -rcs .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment