Can Ant's recursive chmod compete with exec in terms of speed?

匿名 (未验证) 提交于 2019-12-03 03:05:02

问题:

I want to chmod recursively in my build.xml and borrowed the following from this post:

<chmod file="${basedir}/foo/**" perm="755" type="both"/> 

It's unbelievably slow since that directory is deep and includes a large number of files.

This works much better & faster:

<exec executable="chmod" dir="${basedir}/foo" failonerror="true">     <arg line="-R 0755 ." /> </exec> 
  • Are there any downsides of using exec? Speed is of importance.
  • If yes; am I using chmod incorrectly?

回答1:

Exec is faster because the chmod task is gathering all the files and then chmod'ng them. With exec it is one operation. The only "downside" to using exec is that it ties you to UNIX/Linux. I use quotes because the chmod task doesn't run on Windows anyway so this is a moot point.

You are using both correctly and going with exec makes sense.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!