Ant 目标将目录移出另一个目录

发布于 2024-10-05 18:42:20 字数 322 浏览 4 评论 0原文


如何使用 Ant 任务将目录移动到一个目录?

我的目录结构如下:

my/directory/root
               |-dir1/one/same/lib
               |-dir2/two/same/lib
               |-dir3/three/same/lib
               |-dir4/four/same/lib

我想移动和缩放文件夹“same/lib”并将其移动到“my/directory/root”
(最后:我的/目录/root/same/lib)

How to move directories to one directory using an Ant task?

My directory structure is like:

my/directory/root
               |-dir1/one/same/lib
               |-dir2/two/same/lib
               |-dir3/three/same/lib
               |-dir4/four/same/lib

And I would like to move and scale folders "same/lib" and move it to "my/directory/root"
(finally: my/directory/root/same/lib)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千年*琉璃梦 2024-10-12 18:42:20

像这样的东西应该有效:

<target name="moveDirs">
  <mkdir dir="my/directory/root/merged" failonerror="false">
  <move todir="my/directory/root/merged">
    <fileset dir="my/directory/root">
      <include name="dir*/*"/>
    </fileset>
    <mapper>
        <regexpmapper from="^(.*?)dir[0-9]+.(.*)$" to="\1\2"/>
    </mapper>
  </move>
</target>

参考:

Something like this should work:

<target name="moveDirs">
  <mkdir dir="my/directory/root/merged" failonerror="false">
  <move todir="my/directory/root/merged">
    <fileset dir="my/directory/root">
      <include name="dir*/*"/>
    </fileset>
    <mapper>
        <regexpmapper from="^(.*?)dir[0-9]+.(.*)$" to="\1\2"/>
    </mapper>
  </move>
</target>

Reference:

空气里的味道 2024-10-12 18:42:20

查看 Ant Move 任务
请尝试以下操作:

<target name="moveDirs">
  <mkdir dir="my/directory/root/same/lib" failonerror="false">
  <move todir="my/directory/root/same/lib">
    <fileset dir="my/directory/root/dir1/one/same/lib">
      <include name="**/*"/>
    </fileset>
  </move>
  <move todir="my/directory/root/same/lib">
    <fileset dir="my/directory/root/dir2/two/same/lib">
      <include name="**/*"/>
    </fileset>
  </move>
  <move todir="my/directory/root/same/lib">
    <fileset dir="my/directory/root/dir3/three/same/lib">
      <include name="**/*"/>
    </fileset>
  </move>
  <move todir="my/directory/root/same/lib">
    <fileset dir="my/directory/root/dir4/four/same/lib">
      <include name="**/*"/>
    </fileset>
  </move>
</target>

Take a look at the Ant Move Task.
Try the following:

<target name="moveDirs">
  <mkdir dir="my/directory/root/same/lib" failonerror="false">
  <move todir="my/directory/root/same/lib">
    <fileset dir="my/directory/root/dir1/one/same/lib">
      <include name="**/*"/>
    </fileset>
  </move>
  <move todir="my/directory/root/same/lib">
    <fileset dir="my/directory/root/dir2/two/same/lib">
      <include name="**/*"/>
    </fileset>
  </move>
  <move todir="my/directory/root/same/lib">
    <fileset dir="my/directory/root/dir3/three/same/lib">
      <include name="**/*"/>
    </fileset>
  </move>
  <move todir="my/directory/root/same/lib">
    <fileset dir="my/directory/root/dir4/four/same/lib">
      <include name="**/*"/>
    </fileset>
  </move>
</target>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文