我已经运行了一个本地exist-db 服务器,并且我有超过 100 万个 xml 文件想要添加到其中。服务器是无头的,我正在使用 cli 客户端。我的所有文件都位于服务器上数百个 zip 文件的集合中,每个文件包含 5000-10000 个文件。我当前的工作流程是使用以此方式启动的客户端手动添加每个 zip 文件:
eXist-db/bin/client.sh --no-gui
我正在使用
putzip
命令并等待索引完成并将我返回到提示符:
exist:/db/collection> putzip /home/user/data/batch_01/xml_doc_01.zip
entering directory doc0001.xml
storing Zip-entry document doc0001.xml (1 of 5000) ...done
...
entering directory doc5000.xml
storing Zip-entry document doc5000.xml (5000 of 5000) ...done
parsed 1234567 bytes in 6000ms.
... *several minute delay*
exist:/db/collection>
我有数百个 zip 文件,因此手动执行此操作需要很长时间。有没有一种自动化的方法来做到这一点?谢谢你。
find /path/to/base-directory -type f -name xml\*zip | while IFS= read -r name ; do
echo "putzip ${name}" | eXist-db/bin/client.sh --no-gui
done
应该可以工作 - 显然未经测试。