蚂蚁 - 副本只有文件不目录 [英] Ant - copy only file not directory

查看:108
本文介绍了蚂蚁 - 副本只有文件不目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Ant脚本文件夹中的所有文件复制,除了目录文件夹中。

I need to copy all files in a folder except directory in that folder using Ant script.

林。

<copy todir="targetsir">
  <fileset dir="srcdir">
     <include name="**/*.*"/>
  </fileset>
</copy>

但它拷贝该文件夹中的所有文件和目录。

But it copies all files and directory in that folder.

如何限制/该文件夹中过滤目录?

how to restrict/filter directory in that folder?

感谢,

推荐答案

你的意思是 SRCDIR conatins子目录,你不想复制这些,你只想将这些文件一个级别复制 SRCDIR

Do you mean that srcdir conatins sub-directories, and you you don't want to copy them, you just want to copy the files one level beneath srcdir?

<copy todir="targetsir">
  <fileset dir="srcdir">
     <include name="*"/>
     <type type="file"/>
  </fileset>
</copy>

这应该工作。在 ** / *。* 你的问题的意思是每个子目录下的所有文件。只用 * ,将只是将文件匹配下SRCDIR,没有子目录。

That should work. The "**/*.*" in your question means "every file under every sub directory". Just using "*" will just match the files under srcdir, not subdirectories.

编辑以排除空子目录的创建。

这篇关于蚂蚁 - 副本只有文件不目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆