Shell實現迴圈執行curl向Solr匯入json檔案

右介發表於2017-06-08
#!/bin/bash
for file in ./資料夾名/*
do
  echo $file
  curl "http://IP:8983/solr/集合名/update?commit=true" --data-binary @$file -H "Content-type:application/json"
done

 把所有要上傳的json檔案放在一個資料夾裡,在資料夾同一路徑下建立這個.sh檔案並執行。一個檔案上傳結束會自動執行下一個檔案的上傳命令。

相關文章