如何获取文件元数据并将其分配给变量?
我有一个PDF文件。 我想将该文件的(文件名,大小,页面,作者,主题)标记获取,并将其分配给不同的变量到Automator应用程序中。有人可以帮我吗?
I have a pdf file.
I want to get that file's (filename, size, pages, author, subject) metadata tags and assign it to different variables into automator app. Can someone help me with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
bash命令
mdls'/path/to/file.pdf'
应返回PDF文件的所有元数据。如果您在运行shell脚本
操作中运行此操作,它将产生所有可以通过后续操作处理的所有元数据的列表。或者,您可以要求这样的特定元数据键:
将这些键分配给不同的变量有点乏味,但并不难。
The bash command
mdls '/path/to/file.pdf'
should return all of the metadata for a pdf file. if you run this in arun shell script
action, it will produce a list of all metadata that can be processed by a subsequent action.Alternately, you can ask for specific metadata keys like so:
Assigning these to different variables is a bit tedious, but not too difficult.