| org.apache.tools.ant.taskdefs.Copy org.apache.tools.ant.taskdefs.Move
Move | public class Move extends Copy (Code) | | 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.
since: Ant 1.2 |
Constructor Summary | |
public | 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.
If overwrite is set to true, this method overwrites existing file
even if the destination file is newer. | protected void | validateAttributes() . |
Move | public Move()(Code) | | Constructor of object.
This sets the forceOverwrite attribute of the Copy parent class
to true.
|
deleteDir | protected void deleteDir(File d)(Code) | | Go and delete the directory tree.
Parameters: d - the directory to delete |
deleteDir | protected void deleteDir(File d, boolean deleteFiles)(Code) | | Go and delete the directory tree.
Parameters: d - the directory to delete Parameters: deleteFiles - whether to delete files |
doFileOperations | protected void doFileOperations()(Code) | | Override copy's doFileOperations to move the
files instead of copying them.
|
okToDelete | protected boolean okToDelete(File d)(Code) | | Its only ok to delete a directory tree if there are
no files in it.
Parameters: d - the directory to check true if a deletion can go ahead |
renameFile | protected boolean renameFile(File sourceFile, File destFile, boolean filtering, boolean overwrite) throws IOException, BuildException(Code) | | Attempts to rename a file from a source to a destination.
If overwrite is set to true, this method overwrites existing file
even if the destination file is newer. Otherwise, the source file is
renamed only if the destination file is older than it.
Method then checks if token filtering is used. If it is, this method
returns false assuming it is the responsibility to the copyFile method.
Parameters: sourceFile - the file to rename Parameters: destFile - the destination file Parameters: filtering - if true, filtering is in operation, file willbe copied/deleted instead of renamed Parameters: overwrite - if true force overwrite even if destination fileis newer than source file true if the file was renamed exception: IOException - if an error occurs exception: BuildException - if an error occurs |
Methods inherited from org.apache.tools.ant.taskdefs.Copy | public void add(ResourceCollection res)(Code)(Java Doc) public void add(FileNameMapper fileNameMapper)(Code)(Java Doc) public void addFileset(FileSet set)(Code)(Java Doc) protected void buildMap(File fromDir, File toDir, String[] names, FileNameMapper mapper, Hashtable map)(Code)(Java Doc) protected Map buildMap(Resource[] fromResources, File toDir, FileNameMapper mapper)(Code)(Java Doc) public FilterChain createFilterChain()(Code)(Java Doc) public FilterSet createFilterSet()(Code)(Java Doc) public Mapper createMapper() throws BuildException(Code)(Java Doc) protected void doFileOperations()(Code)(Java Doc) protected void doResourceOperations(Map map)(Code)(Java Doc) public void execute() throws BuildException(Code)(Java Doc) public String getEncoding()(Code)(Java Doc) protected FileUtils getFileUtils()(Code)(Java Doc) protected Vector getFilterChains()(Code)(Java Doc) protected Vector getFilterSets()(Code)(Java Doc) public String getOutputEncoding()(Code)(Java Doc) public boolean getPreserveLastModified()(Code)(Java Doc) public boolean isEnableMultipleMapping()(Code)(Java Doc) protected void scan(File fromDir, File toDir, String[] files, String[] dirs)(Code)(Java Doc) protected Map scan(Resource[] fromResources, File toDir)(Code)(Java Doc) public void setEnableMultipleMappings(boolean enableMultipleMappings)(Code)(Java Doc) public void setEncoding(String encoding)(Code)(Java Doc) public void setFailOnError(boolean failonerror)(Code)(Java Doc) public void setFile(File file)(Code)(Java Doc) public void setFiltering(boolean filtering)(Code)(Java Doc) public void setFlatten(boolean flatten)(Code)(Java Doc) public void setGranularity(long granularity)(Code)(Java Doc) public void setIncludeEmptyDirs(boolean includeEmpty)(Code)(Java Doc) public void setOutputEncoding(String encoding)(Code)(Java Doc) public void setOverwrite(boolean overwrite)(Code)(Java Doc) public void setPreserveLastModified(String preserve)(Code)(Java Doc) public void setPreserveLastModified(boolean preserve)(Code)(Java Doc) public void setTodir(File destDir)(Code)(Java Doc) public void setTofile(File destFile)(Code)(Java Doc) public void setVerbose(boolean verbose)(Code)(Java Doc) protected boolean supportsNonFileResources()(Code)(Java Doc) protected void validateAttributes() throws BuildException(Code)(Java Doc)
|
|
|