From f671c8b0b63bc31997012f5452ec745d44549606 Mon Sep 17 00:00:00 2001 From: Deposite Pirate Date: Sun, 12 Oct 2025 13:37:46 +0200 Subject: Scripts to tame macOS noise rsmac.fish -> recursively delete all .DS_Store files rsdos.fish -> recursively delete all user.DOSATTRIB xattrs rsxattr.fish -> recursively delete all user xattrs new file: functions/rsdos.fish new file: functions/rsmac.fish new file: functions/rsxattr.fish --- functions/rsxattr.fish | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 functions/rsxattr.fish (limited to 'functions/rsxattr.fish') diff --git a/functions/rsxattr.fish b/functions/rsxattr.fish new file mode 100644 index 0000000..4101890 --- /dev/null +++ b/functions/rsxattr.fish @@ -0,0 +1,29 @@ +function rsxattr --description 'Recursively delete all user xattrs' + +if not command -sq 'find' + echo "Can't find find." + return 1 +end + +if not command -sq 'sed' + echo "Can't find sed." + return 1 +end + +if not command -sq 'awk' + echo "Can't find awk." + return 1 +end + +if not command -sq 'setfattr'; and command -sq 'getfattr' + echo "Can't find xattr tools." + return 1 +end + +for file in (getfattr -R -h -d . 2>/dev/null | grep '^# file:' | sed 's/^# file: //') + for attr in (getfattr -m '^user\.' "$file" 2>/dev/null | awk '/^[^#]/ {print $1}') + setfattr -x $attr $file 2>/dev/null + end +end + +end -- cgit v1.3.1