I created some temp files with a custom task in the system’s default temp folder. Depending on different configuration, there will be two or three files — one is codebaseXX.log (the XX part means a number string that Java created automatically for the temp file) and the other(s) is(are) local-changes-XX.diff.
Currently, in the file-generating task, I put the full name of the first file and “local-changes*.diff” into two properties (say file1 and file2). And then I copy them back using <copy>:
<copy todir="log/configs" >
<fileset dir="${tmpdir}">
<include name="${file1}" />
<include name="${file2}" />
</fileset>
</copy>
For example, I may have the following files generated:
codebase529846369165360813.log
local-changes-original5410491830492606676.diff
local-changes-simple7778114354296759394.diff (if exists)
and I want to copy exactly what is exactly generated this time (because there are changes that some old files are not deleted) and rename them, like this:
codebase.log
local-changes-original.diff
local-changes-simple.diff (if exists)
My question is: My task knows exactly which files is generated, but how to tell the other tasks that those files should be processed? Also, how to smartly rename them?
Have you considered using ANT tempfile task to manage these temporary files for you?