使用textutil进行文件格式转换

Typora

使用textutil进行文件格式转换

textutil进行文件转换支持的格式有:

  • txt,
  • html,
  • rtf, rtfd,
  • doc, docx,
  • wordml, odt,
  • webarchive

同时,pdf是默认支持转为

  • txt
  • rtf
  • png/jpeg等图片格式

转换单个文件的命令为:

 
 
textutil -convert doc /path/to/my/file.docx

批量转换文件的命令为:

 
xxxxxxxxxx
 
textutil -convert doc /path/to/location/*.docx
 
xxxxxxxxxx
 
textutil -convert docx xx.pdf -output xx.docx

参数说明:

  • convert 后的参数是转换后的文件格式
  • output后是输出文件的格式.

自带的例子:

 
​x
 
textutil -info foo.rtf
displays information about foo.rtf.
textutil -convert html foo.rtfconverts foo.rtf into foo.html.
textutil -convert rtf -font Times -fontsize 10 foo.txtconverts foo.txt into foo.rtf, using Times 10 for the font.
textutil -cat html -title "Several Files" -output index.html ∗.rtf
loads all RTF files in the current directory, concatenates their contents, and writes the result out as index.html
with the HTML title set to "Several Files".

文档:

  • man textutil

  • man textutil -t | open -fa Preview

    textutil

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值