Ant 复制文件而不覆盖 [英] Ant copy files without overwriting
问题描述
ant 中是否有任何命令可以将文件从一个文件夹结构复制到另一个文件夹结构,而无需检查上次修改日期/时间 覆盖文件.基本上我想要从文件夹 A 到文件夹 B 的所有额外文件.也就是说:没有文件夹 B 的文件被替换,但文件夹 A 的额外文件来到文件夹 B.
Is there any command in ant to copy files from one folder structure to another without checking the last modified date/time overwriting files. Basically I want all extra files from folder A to folder B. That is: no files of folder B are replaced but extra files of folder A comes to folder B.
我看到了ant copy"和ant move"命令,但没有帮助.任何建议.
I saw "ant copy" and "ant move" commands, but didn't help. Any suggestions.
推荐答案
你可以这样做:
复制单个文件
<copy file="myfile.txt" tofile="mycopy.txt"/>
复制单个文件到目录
<copy file="myfile.txt" todir="../some/other/dir"/>
复制一个目录到另一个目录
Copy a directory to another directory
<copy todir="../new/dir"><fileset dir="src_dir"/></copy>
<copy todir="../new/dir"><fileset dir="src_dir"/></copy>
将一组文件复制到一个目录等等...
Copy a set of files to a directory and more...
请参阅此链接了解更多信息.复制任务
please see this link for more information.Copy Task
这篇关于Ant 复制文件而不覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!