Curl Bluemix文档转换服务-如何转换多个文档

Curl Bluemix文档转换服务-如何转换多个文档,curl,ibm-cloud,ibm-watson,document-conversion,Curl,Ibm Cloud,Ibm Watson,Document Conversion,我的目标是一个JSON格式的文档文件,它将来自50-100 MS Word或PDF文档 是否有办法向“convert_document”命令提供多个文档?我尝试使用curl提供多个.pdf或*.doc文件,如下所示: curl -u "username":"password" -F "config={\"conversion_target\":\"ANSWER_UNITS\"};type=application/json" -F "file=@\*.doc;type=appli

我的目标是一个JSON格式的文档文件,它将来自50-100 MS Word或PDF文档

是否有办法向“convert_document”命令提供多个文档?我尝试使用curl提供多个.pdf或*.doc文件,如下所示:

 curl -u
  "username":"password" 
  -F "config={\"conversion_target\":\"ANSWER_UNITS\"};type=application/json" 
  -F "file=@\*.doc;type=application/msword" -X POST
 "https://gateway.watsonplatform.net/document-conversion-experimental/api/v1/convert_document"
不幸的是,这给了我一个错误:
curl:(26)无法打开文件“*.doc”

我也尝试过
-F“file=@file1.doc,file2.doc,file3.doc”
,但也会出现错误。

文档转换服务一次只接受一个文件,但您可以多次调用它并连接结果

 #!/bin/bash
 USERNAME="<service-username>"
 PASSWORD="<service-password>"
 URL="https://gateway.watsonplatform.net/document-conversion-experimental/api/v1/convert_document"
 DIRECTORY="/path/to/documents"
 for doc in *.doc
 do
     echo "Converting - $doc"
     curl -u "$USERNAME:$PASSWORD" \
     -F 'config={"conversion_target":"ANSWER_UNITS"};type=application/json' \
     -F "file=@$doc;type=application/pdf" "$URL"
 done
#/bin/bash
USERNAME=“”
PASSWORD=“”
URL=”https://gateway.watsonplatform.net/document-conversion-experimental/api/v1/convert_document"
DIRECTORY=“/path/to/documents”
对于*.doc中的文档
做
回显“转换-$doc”
curl-u“$USERNAME:$PASSWORD”\
-F'config={“转换目标”:“应答单元”};type=application/json'\
-F“file=@$doc;type=application/pdf”“$URL”
完成