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

查看:317
本文介绍了我如何删除"扩展属性"在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 会显示您的命令行选项,<一个href=\"http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/xattr.1.html\">xattr有一个男人页面。

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

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

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