递归 xattr 严重失败
Recursive xattr fails horribly
我一直在尝试找到一种方法来递归删除某些文件的所有 xattr
,但是,previous methods 的 none 似乎不再有效;可能还有一个新引入的错误?
$ xattr -rc .
option -r not recognized
$ xattr -c .
option -c not recognized
..现在是大结局!
$ find . -exec xattr -l {} \;
com.apple.FinderInfo:
Traceback (most recent call last):
File "/usr/local/bin/xattr", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/xattr/tool.py", line 200, in main
print(_dump(attr_value))
File "/Library/Python/2.7/site-packages/xattr/tool.py", line 77, in _dump
printable = s.translate(_FILTER)
TypeError: character mapping must return integer, None or unicode
哦,看它在垃圾堆中发现了一个 xattr
...如果知道如何、是什么或谁将 xattr
工具毁得如此严重,那将会很有趣。我只需要递归地删除扩展属性,真的!
您似乎在 /usr/local/bin/xattr 中安装了一个非标准的 xattr
命令(macOS 附带的标准命令是 /usr/bin/xattr)。这些是 Python 个错误,所以可能是 this one?无论如何,它不使用与标准语法相同的语法,因此安装它会引起混淆;我建议将其删除或将其重命名为不同的名称;否则它可能会破坏任何试图使用 xattr
.
的脚本(你的或系统的)
这也发生在我身上。我相信是由于我的 $PATH
/usr/local/bin:/usr/bin
我的 user local bin
在我的 system usr/bin
之前。
感谢这些帖子,我解决了问题。
xattr 安装在两个位置。
Show whether the target is a builtin, a function, an alias or an external executable.(Source) /
type -a xattr
# xattr is /usr/local/bin/xattr
# xattr is /usr/bin/xattr
而且它们肯定是不同的。
/usr/local/bin/xattr -h
usage: xattr [-slz] file [file ...]
xattr -p [-slz] attr_name file [file ...]
xattr -w [-sz] attr_name attr_value file [file ...]
xattr -d [-s] attr_name file [file ...]
The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to attr_value.
The fourth form (-d) deletes the xattr attr_name.
options:
-h: print this help
-s: act on symbolic links themselves rather than their targets
-l: print long format (attr_name: attr_value)
-z: compress or decompress (if compressed) attribute value in zip format
VS.
/usr/bin/xattr -h
usage: xattr [-l] [-r] [-s] [-v] [-x] file [file ...]
xattr -p [-l] [-r] [-s] [-v] [-x] attr_name file [file ...]
xattr -w [-r] [-s] [-x] attr_name attr_value file [file ...]
xattr -d [-r] [-s] attr_name file [file ...]
xattr -c [-r] [-s] file [file ...]
The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to the string attr_value.
The fourth form (-d) deletes the xattr attr_name.
The fifth form (-c) deletes (clears) all xattrs.
options:
-h: print this help
-l: print long format (attr_name: attr_value and hex output has offsets and
ascii representation)
-r: act recursively
-s: act on the symbolic link itself rather than what the link points to
-v: also print filename (automatic with -r and with multiple files)
-x: attr_value is represented as a hex string for input and output
因此,如果您出于某种原因确实想保留两者,那么您可以像这样明确地调用它们:
/usr/bin/xattr -lr ~
/usr/local/bin/xattr -l ~
我一直在尝试找到一种方法来递归删除某些文件的所有 xattr
,但是,previous methods 的 none 似乎不再有效;可能还有一个新引入的错误?
$ xattr -rc .
option -r not recognized
$ xattr -c .
option -c not recognized
..现在是大结局!
$ find . -exec xattr -l {} \;
com.apple.FinderInfo:
Traceback (most recent call last):
File "/usr/local/bin/xattr", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/xattr/tool.py", line 200, in main
print(_dump(attr_value))
File "/Library/Python/2.7/site-packages/xattr/tool.py", line 77, in _dump
printable = s.translate(_FILTER)
TypeError: character mapping must return integer, None or unicode
哦,看它在垃圾堆中发现了一个 xattr
...如果知道如何、是什么或谁将 xattr
工具毁得如此严重,那将会很有趣。我只需要递归地删除扩展属性,真的!
您似乎在 /usr/local/bin/xattr 中安装了一个非标准的 xattr
命令(macOS 附带的标准命令是 /usr/bin/xattr)。这些是 Python 个错误,所以可能是 this one?无论如何,它不使用与标准语法相同的语法,因此安装它会引起混淆;我建议将其删除或将其重命名为不同的名称;否则它可能会破坏任何试图使用 xattr
.
这也发生在我身上。我相信是由于我的 $PATH
/usr/local/bin:/usr/bin
我的 user local bin
在我的 system usr/bin
之前。
感谢这些帖子,我解决了问题。
xattr 安装在两个位置。
Show whether the target is a builtin, a function, an alias or an external executable.(Source) /
type -a xattr
# xattr is /usr/local/bin/xattr
# xattr is /usr/bin/xattr
而且它们肯定是不同的。
/usr/local/bin/xattr -h
usage: xattr [-slz] file [file ...]
xattr -p [-slz] attr_name file [file ...]
xattr -w [-sz] attr_name attr_value file [file ...]
xattr -d [-s] attr_name file [file ...]
The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to attr_value.
The fourth form (-d) deletes the xattr attr_name.
options:
-h: print this help
-s: act on symbolic links themselves rather than their targets
-l: print long format (attr_name: attr_value)
-z: compress or decompress (if compressed) attribute value in zip format
VS.
/usr/bin/xattr -h
usage: xattr [-l] [-r] [-s] [-v] [-x] file [file ...]
xattr -p [-l] [-r] [-s] [-v] [-x] attr_name file [file ...]
xattr -w [-r] [-s] [-x] attr_name attr_value file [file ...]
xattr -d [-r] [-s] attr_name file [file ...]
xattr -c [-r] [-s] file [file ...]
The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to the string attr_value.
The fourth form (-d) deletes the xattr attr_name.
The fifth form (-c) deletes (clears) all xattrs.
options:
-h: print this help
-l: print long format (attr_name: attr_value and hex output has offsets and
ascii representation)
-r: act recursively
-s: act on the symbolic link itself rather than what the link points to
-v: also print filename (automatic with -r and with multiple files)
-x: attr_value is represented as a hex string for input and output
因此,如果您出于某种原因确实想保留两者,那么您可以像这样明确地调用它们:
/usr/bin/xattr -lr ~
/usr/local/bin/xattr -l ~