简体   繁体   English

如何使用Ant,文件和文件夹`chmod -R + w`?

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

I'd like to do the equivalent of a chmod -R +w foo/ in an Ant build script. 我想在Ant构建脚本中执行相当于chmod -R +w foo/的操作。

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. 积分与OP共享。

See also 也可以看看

To chmod one can use exec: 对于chmod,可以使用exec:

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

Credits 积分

Here's the gradle version : 这是gradle版本:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM