开发者

How to `chmod -R +w` with Ant, files and folders?

开发者 https://www.devze.com 2023-01-07 05:39 出处:网络
I\'d like to do the equivalent of a chmod开发者_如何转开发 -R +w foo/ in an Ant build script.

I'd like to do the equivalent of a chmod开发者_如何转开发 -R +w foo/ in an Ant build script.

So far I'm using this:

<chmod perm="g+w">
   <dirset dir="${basedir}/foo">
   </dirset>
   <fileset dir="${basedir}/foo">
   </fileset>
</chmod>

Is there a neater way to write that to include files and folders recursively?


The following does work:

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

Credits shared with the OP.

See also

  • Chmod Task


To chmod one can use exec:

<exec executable="chmod" dir="${basedir}/foo" failonerror="true">
    <arg line="-R 0755 ." />
</exec>

Credits


Here's the gradle version :

task fixPermissions << {
    ant.chmod(dir:"$rootDir/foo", perm:"g+w", includes:"**/*")
}
0

精彩评论

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