[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

Apache Ant - Change extension on file

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.
1 Solution
A quick and dirty way would be to just stick the new extension on the end...so your input file would be called:


and your output file could be called:


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

Or something...

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now