开发者

Using find to pass files to a jar

开发者 https://www.devze.com 2023-03-03 13:45 出处:网络
Using \'find\' I\'m pla开发者_如何学Cnning to pass all files with a specific ending as an argument to a jar-file.

Using 'find' I'm pla开发者_如何学Cnning to pass all files with a specific ending as an argument to a jar-file.

find $directory -type f -name "*.in"

Somehow this is supposed to happen:

java -jar MyJar-jar input.in

How can this be performed?

Thanks in Advance


find "$directory" -type f -name '*.in' -exec java -jar MyJar.jar {} \;

Replace \; with + if the application can take more than one file at a time as arguments.


xargs -0 -a<(find $directory -type f -name '*.in' -print0) java -jar MyJar.jar


java -jar MyJar.jar `find $directory -type f -name "*.in"`

should do the trick.

0

精彩评论

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