Apache Ant - Change extension on file

Posted on 2006-03-30
Last Modified: 2006-11-18
This might not be perfectly on topic, but I can't find anyone that is...

I have an exec in Ant that looks like this:

<exec    taskname    = "convert"
                                executable    = "convert"
                                failonerror    = "true">
                            <arg line="in=@{file} out=???" />

I want to use a command that converts a file. THe in infile name has one extension and the out file another, but the rest of the file name should be the same. How do I get it this way?

The arg line is messed up since I don't know what to write.
Question by:mdoland
    1 Comment
    LVL 35

    Accepted Solution

    A quick and dirty way would be to just stick the new extension on the your input file would be called:


    and your output file could be called:


                              <arg line="in=@{file} out=@{file}.ext" />

    Or something...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
    Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now