How to rename a folder using Ant?
ant
Solution
The move task does do what you're after, but the naming is a bit confusing. If you consider your directory is a 'file' in the Java sense - a file being a filesystem handle that can represent, among others a directory or a file in the usual sense - then the move task makes sense.
So the following
<move file="mySourceDirName" tofile="myTargetDirName"/>
means rename/move the directory`mySourceDirName` to be instead `myTargetDirName`.
The following then
<move file="mySourceDirName" todir="someExistingDir"/>
means to move the directory `mySourceDirName` to become a child directory of the existing `someExistingDir` directory.
So, in ant the 'file' attribute refers to the target in question, and the 'todir' attribute refers to the directory that is the new parent location for the target file or directory.
Problem
I want to rename my application folder with a time stamp and then unzip a newer version of my app using the same folder name. Using the Ant (`move` task), it looks like you can move contents from one folder to another. Is this the only way I can do this in Ant?