FileDocCategorySizeDatePackage
Copyfile.javaAPI DocApache Ant 1.703436Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs

Copyfile

public class Copyfile extends org.apache.tools.ant.Task
Copies a file.
since
Ant 1.1
deprecated
The copyfile task is deprecated since Ant 1.2. Use copy instead.

Fields Summary
private File
srcFile
private File
destFile
private boolean
filtering
private boolean
forceOverwrite
Constructors Summary
Methods Summary
public voidexecute()
Execute the task.

throws
BuildException on error

        log("DEPRECATED - The copyfile task is deprecated.  Use copy instead.");

        if (srcFile == null) {
            throw new BuildException("The src attribute must be present.",
                                     getLocation());
        }

        if (!srcFile.exists()) {
            throw new BuildException("src " + srcFile.toString()
                                     + " does not exist.", getLocation());
        }

        if (destFile == null) {
            throw new BuildException("The dest attribute must be present.",
                                     getLocation());
        }

        if (srcFile.equals(destFile)) {
            log("Warning: src == dest", Project.MSG_WARN);
        }

        if (forceOverwrite
            || srcFile.lastModified() > destFile.lastModified()) {
            try {
                getProject().copyFile(srcFile, destFile, filtering, forceOverwrite);
            } catch (IOException ioe) {
                String msg = "Error copying file: " + srcFile.getAbsolutePath()
                    + " due to " + ioe.getMessage();
                throw new BuildException(msg);
            }
        }
    
public voidsetDest(java.io.File dest)
Set the destination file.

param
dest the destination file.

        destFile = dest;
    
public voidsetFiltering(java.lang.String filter)
The filtering attribute. Default is false.

param
filter if true use filtering

        filtering = Project.toBoolean(filter);
    
public voidsetForceoverwrite(boolean force)
The forceoverwrite attribute. Default is false.

param
force if true overwrite even if the destination file is newer that the source file

        forceOverwrite = force;
    
public voidsetSrc(java.io.File src)
Set the source file.

param
src the source file.


                  
        
        srcFile = src;