org.apache.tools.ant.taskdefs
public class Move extends Copy
Source files and directories are only deleted when the file or directory has been copied to the destination successfully. Filtering also works.
This implementation is based on Arnout Kuiper's initial design document, the following mailing list discussions, and the copyfile/copydir tasks.
Since: Ant 1.2
UNKNOWN: category="filesystem"
Constructor Summary | |
---|---|
Move()
Constructor of object.
|
Method Summary | |
---|---|
protected void | deleteDir(File d)
Go and delete the directory tree. |
protected void | deleteDir(File d, boolean deleteFiles)
Go and delete the directory tree. |
protected void | doFileOperations()
Override copy's doFileOperations to move the files instead of copying them. |
protected boolean | okToDelete(File d)
Its only ok to delete a directory tree if there are no files in it. |
protected boolean | renameFile(File sourceFile, File destFile, boolean filtering, boolean overwrite)
Attempts to rename a file from a source to a destination.
|
void | setPerformGcOnFailedDelete(boolean b)
Whether to perform a garbage collection before retrying a failed delete.
|
protected void | validateAttributes() {@inheritDoc }. |
Parameters: d the directory to delete
Parameters: d the directory to delete deleteFiles whether to delete files
Parameters: d the directory to check
Returns: true if a deletion can go ahead
Parameters: sourceFile the file to rename destFile the destination file filtering if true, filtering is in operation, file will be copied/deleted instead of renamed overwrite if true force overwrite even if destination file is newer than source file
Returns: true if the file was renamed
Throws: IOException if an error occurs BuildException if an error occurs
This may be required on Windows (where it is set to true by default) but also on other operating systems, for example when deleting directories from an NFS share.
Since: Ant 1.8.3