我怎么能压缩多个文件夹分别与蚂蚁? [英] How can I zip multiple folders individually with ant?

查看:161
本文介绍了我怎么能压缩多个文件夹分别与蚂蚁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有多个子文件夹(例如foo,酒吧,巴兹),我该如何使用蚂蚁由一个单独压缩他们到foo​​.zip,bar.zip和baz.zip,没有做他们一个文件夹?

If I have a folder with multiple subfolders (e.g. foo, bar, baz), how can I use ant to zip them individually into foo.zip, bar.zip and baz.zip, without doing them one by one?

理想的情况下也应该有一种方法来指定要压缩哪些文件/子文件夹,而不是每一个人。

Ideally there should also be a way to specify which files/subfolders to zip rather than "every single one".

推荐答案

您不想使用ant-contrib请。蚂蚁的contrib很烂,每次使用它时,你就招致技术债务。数一件事要记住使用时,蚂蚁:蚂蚁,让蚂蚁会。蚂蚁是它是什么。它的声明。 蚂蚁原意是性能和工作肉在java中正在做(如果你有一个调试器和测试框架一个真正的IDE)简单的声明。作为蚂蚁风格元素注意 - 让蚂蚁是蚂蚁。如果你有使用蚂蚁的contrib,你应该让自己的Ant任务。如果你不能做到这一点,不要用蚂蚁。蚂蚁的contrib发生最坏的蚂蚁蚂蚁使情况变得更糟,你很快就会发现事情难以维护。足够的咆哮。

You don't want to use ant-contrib. ant-contrib sucks, every time you use it, you're incurring technical debt. The number one thing to keep in mind when using ant: let ant be ant. ant is what it is. it's declarative. The original intent of ant was simple declarations of properties and with the meat of the work being done in java (where you had a real IDE with a debugger and test frameworks). As noted in elements of ant style - "Let ant be ant". If you have to use ant-contrib, you should make your own ant task. If you can't do that, don't use ant. ant-contrib takes the worst of ant ant makes it worse, you'll soon find things unmaintainable. Enough ranting.

您甚至不需要做任务为这一个,这应该工作......它需要在/ tmp中的一切目录及拉链起来。应该让你最成名的途径。

You don't even need to make a task for this one, this should work... it takes everything dir in /tmp and zips it up. should get you most of the way there.

    <mapper id="zip" type="glob"
    from="*"
    to="*.zip"/>

<target name="zip-craziness">
    <apply executable="zip">
        <targetfile/>
        <srcfile/>
        <dirset dir="/tmp" />
         <mapper refid="zip"/>
    </apply>
</target>

这篇关于我怎么能压缩多个文件夹分别与蚂蚁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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