从一个目录下的所有文件和子目录复制到同一位置 [英] copy all files from one directory and subdirectories into single location

查看:159
本文介绍了从一个目录下的所有文件和子目录复制到同一位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,请帮助尽快...这里是我的code从一个位置中的所有.txt文件复制到其他:

Hi all please help ASAP...Here is my code for copying all .txt files from one location to other:

<copy todir="../new/dir">
    <fileset dir="C:/build/build">
        <include name="**/*.txt"/>
    </fileset>
</copy>

Altough它工作正常,它被正确拷贝文件,但问题是,它是在目的地maintainig非空目录的目录结构也,我要下的所有文件,C:/构建/编译,其子目录建议立即进行删除。

Altough it is working fine, it is copying files correctly but the problem is that it is maintainig the directory structure for non-empty directories at destination also, I want all the files under "C:/build/build" and its sub-directories shoul

推荐答案

这是你写的,也许要拼合文件?

From what you've written maybe you want to flatten the files?

<一个href=\"http://ant.apache.org/manual/Tasks/copy.html\">http://ant.apache.org/manual/Tasks/copy.html

<copy todir="../new/dir" flatten="true">
    <fileset dir="C:/build/build">
        <include name="**/*.txt"/>
    </fileset>
</copy>

这篇关于从一个目录下的所有文件和子目录复制到同一位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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