如何删除“扩展属性"?在 Mac OS X 中的文件上? [英] How do I remove the "extended attributes" on a file in Mac OS X?

查看:49
本文介绍了如何删除“扩展属性"?在 Mac OS X 中的文件上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行压力测试的 AppleScript 脚本.部分测试是打开、保存和关闭某些文件.不知何故,这些文件获得了一些禁止保存文件的扩展属性".这会导致压力测试失败.

I have an AppleScript script that runs a stress test. Part of the test is to open, save, and close certain files. Somehow, the files have picked up some "extended attributes" that prohibit the files from being saved. That causes the stress test to fail.

如何删除扩展属性?

推荐答案

使用 xattr 命令.您可以检查扩展属性:

Use the xattr command. You can inspect the extended attributes:

$ xattr s.7z
com.apple.metadata:kMDItemWhereFroms
com.apple.quarantine

并使用 -d 选项删除一个扩展属性:

and use the -d option to delete one extended attribute:

$ xattr -d com.apple.quarantine s.7z
$ xattr s.7z
com.apple.metadata:kMDItemWhereFroms

您还可以使用 -c 选项删除所有扩展属性:

you can also use the -c option to remove all extended attributes:

$ xattr -c s.7z
$ xattr s.7z

xattr -h 将显示命令行选项,以及 xattr 有一个手册页.

xattr -h will show you the command line options, and xattr has a man page.

这篇关于如何删除“扩展属性"?在 Mac OS X 中的文件上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆