|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.ProjectComponent | +--org.apache.tools.ant.Task | +--org.apache.tools.ant.taskdefs.Copy | +--org.apache.tools.ant.taskdefs.Move
Moves a file or directory to a new file or directory. By default, the destination file is overwritten if it already exists. When overwrite is turned off, then files are only moved if the source file is newer than the destination file, or when the destination file does not exist.
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.
Field Summary |
Fields inherited from class org.apache.tools.ant.taskdefs.Copy |
completeDirMap, destDir, destFile, dirCopyMap, failonerror, file, fileCopyMap, filesets, filtering, flatten, forceOverwrite, includeEmpty, mapperElement, preserveLastModified, verbosity |
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Constructor Summary | |
Move()
Constructor of object. |
Method Summary | |
protected void |
deleteDir(java.io.File d)
Go and delete the directory tree. |
protected void |
doFileOperations()
Override copy's doFileOperations to move the files instead of copying them. |
void |
execute()
Performs the move operation. |
protected boolean |
okToDelete(java.io.File d)
Its only ok to delete a directory tree if there are no files in it. |
protected boolean |
renameFile(java.io.File sourceFile,
java.io.File destFile,
boolean filtering,
boolean overwrite)
Attempts to rename a file from a source to a destination. |
Methods inherited from class org.apache.tools.ant.taskdefs.Copy |
add, addFileset, buildMap, createFilterChain, createFilterSet, createMapper, getEncoding, getFileUtils, getFilterChains, getFilterSets, getOutputEncoding, getPreserveLastModified, isEnableMultipleMapping, scan, setEnableMultipleMappings, setEncoding, setFailOnError, setFile, setFiltering, setFlatten, setGranularity, setIncludeEmptyDirs, setOutputEncoding, setOverwrite, setPreserveLastModified, setPreserveLastModified, setTodir, setTofile, setVerbose, validateAttributes |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Move()
Method Detail |
public void execute() throws BuildException
execute
in class Copy
BuildException
- if an error occursprotected void doFileOperations()
doFileOperations
in class Copy
protected boolean okToDelete(java.io.File d)
d
- the directory to check
protected void deleteDir(java.io.File d)
d
- the directory to deleteprotected boolean renameFile(java.io.File sourceFile, java.io.File destFile, boolean filtering, boolean overwrite) throws java.io.IOException, BuildException
sourceFile
- the file to renamedestFile
- the destination filefiltering
- if true, filtering is in operation, file will
be copied/deleted instead of renamedoverwrite
- if true force overwrite even if destination file
is newer than source file
java.io.IOException
- if an error occurs
BuildException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |