从Snow Leopard中的文件中剥离元数据

Min*_*int 0 unix macos metadata spotlight osx-snow-leopard

我找到了命令"mdls",它将显示元数据,但我看不到如何删除它.

我想从我的文件中删除评论"kMDItemFinderComment","kMDItemWhereFroms".

有没有办法做到这一点?

Jef*_*tte 5

我想你正在寻找终端中提供的xattr命令:

xattr -pr com.apple.metadata:kMDItemFinderComment /
Run Code Online (Sandbox Code Playgroud)

这将打印启动卷上所有文件的所有查找器注释.要删除,请使用-d开关:

xattr -dr com.apple.metadata:kMDItemFinderComment /
Run Code Online (Sandbox Code Playgroud)

在批量运行之前,您应该在单个文件上对此进行测试.

usage: xattr [-l] [-r] [-v] [-x] file [file ...]
       xattr -p [-l] [-r] [-v] [-x] attr_name file [file ...]
       xattr -w [-r] [-v] [-x] attr_name attr_value file [file ...]
       xattr -d [-r] [-v] 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 the string attr_value.
The fourth form (-d) deletes the xattr attr_name.

options:
  -h: print this help
  -r: act recursively
  -l: print long format (attr_name: attr_value and hex output has offsets and
      ascii representation)
  -v: also print filename (automatic with -r and with multiple files)
  -x: attr_value is represented as a hex string for input and output
Run Code Online (Sandbox Code Playgroud)