代码之家  ›  专栏  ›  技术社区  ›  Wernight

如何使用Ant、文件和文件夹“chmod-R+w”?

  •  16
  • Wernight  · 技术社区  · 14 年前

    我想做相当于 chmod -R +w foo/ 蚂蚁 生成脚本。

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

    有没有一种更简洁的方法来编写它来包含文件 文件夹 递归地

    3 回复  |  直到 14 年前
        1
  •  22
  •   Pascal Thivent    14 年前

    以下操作有效:

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

    与OP共享的学分。

    另请参见

        2
  •  4
  •   Community CDub    8 年前

    要使用chmod,可以使用exec:

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

    Credits

        3
  •  2
  •   ohad serfaty    10 年前

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