开发者

Solr : Can post.jar be used to post files recursively within folder and subfolder

开发者 https://www.devze.com 2023-03-31 09:40 出处:网络
If I would like to post all the xml files in a folder then I use post.jar. java -jar post.开发者_如何学编程jar *.xml

If I would like to post all the xml files in a folder then I use post.jar.

java -jar post.开发者_如何学编程jar *.xml

In case if I would like to post the files recursively ( i.e post xml files under subfolder level also is there anyway to achieve this.)


If you're on a unix-like (OSX or Linux), you can do something like this:

find . -name \*xml | xargs java -jar post.jar 

That'll find all .xml files in or under the current directory ('.') and pass them as parameters to the java -jar post.jar command.

find is incredibly opaque, but very useful for stuff like this.


Please think twice before using stuff under the /example directory of Solr. I use Solr from Tomcat (instead of the Jetty embedded in the start.jar) and I use URLLIB2 in Python for POSTing data to Solr. (Jetty is a production-level software, so dont worry too much about that).

So, for uploading files, consider writing it in your favorite programming language. You can implement folder recursion yourself. For POSTing files, you need libCURL , which can send HTTP GET, form POSTs, multipart POSTs etc. A C program using libCURL needs no more than 8 lines to POST a file. CURL bindings exist for all major languages, so you can recycle libCURL stuff written in C to PHP, for example.


Yes, you can!

You just need to ad the -Drecursive flag.

java -Drecursive -jar post.jar *

For further options for the flags and usage just use:

java -jar post.jar -h
0

精彩评论

暂无评论...
验证码 换一张
取 消