Skip to content

Instantly share code, notes, and snippets.

@inoperable
Created November 21, 2017 00:58
Show Gist options
  • Save inoperable/4a0a119b5edadfe95bf3111904eff873 to your computer and use it in GitHub Desktop.
Save inoperable/4a0a119b5edadfe95bf3111904eff873 to your computer and use it in GitHub Desktop.
Recursively remove extended file attributes in OS X
#! /bin/bash
# Sometimes downloaded files in OS X contain extended attributes that disallow
# the files to be accessed by apache. Nuke the site from orbit.
rmextattr() {
find . | while read filename
do
while read attr
do
echo "removing ${attr} from ${filename}"
xattr -d "${attr}" "${filename}"
done < <(xattr "${filename}")
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment