Package org.oddjob.io
Class DeleteJob
java.lang.Object
org.oddjob.io.DeleteJob
- All Implemented Interfaces:
Serializable,Callable<Integer>
- Author:
- Rob Gordon
- See Also:
Description
Delete a file or directory, or files and directories.Unless the force property is set, this job will cause an exception if an attempt is made to delete a non empty directory.
Example
Delete all files from a directory. The directory is the first of Oddjob's arguments.
<oddjob id="this">
<job>
<delete id="delete">
<files>
<files files="${this.args[0]}/*"/>
</files>
</delete>
</job>
</oddjob>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncall()protected voiddeleteFile(File fileToDelete) intintintFile[]getFiles()Get the files.intintgetName()Get the name.booleanisForce()Getter for force property.booleanprotected booleanvoidreset()voidSet the files.voidsetForce(boolean force) Setter for force property.voidsetLogEvery(int logEvery) voidsetMaxErrors(int maxErrors) voidSet the namevoidsetReallyRoot(boolean reallyRoot) toString()
-
Constructor Details
-
DeleteJob
public DeleteJob()
-
-
Method Details
-
call
- Specified by:
callin interfaceCallable<Integer>- Throws:
IOExceptionInterruptedException
-
deleteFile
- Throws:
IOException
-
isRoot
-
reset
public void reset() -
getName
Get the name.- Returns:
- The name.
-
setName
Set the name- Parameters:
name- The name.
-
getFiles
Get the files.- Returns:
- The files.
-
setFiles
Set the files.- Parameters:
files- The files.
-
isForce
public boolean isForce()Getter for force property.- Returns:
- The force property.
-
setForce
public void setForce(boolean force) Setter for force property.- Parameters:
force- The force property.
-
setLogEvery
public void setLogEvery(int logEvery) -
getLogEvery
public int getLogEvery() -
setReallyRoot
public void setReallyRoot(boolean reallyRoot) -
isReallyRoot
public boolean isReallyRoot() -
getFileCount
public int getFileCount() -
getDirCount
public int getDirCount() -
getErrorCount
public int getErrorCount() -
getMaxErrors
public int getMaxErrors() -
setMaxErrors
public void setMaxErrors(int maxErrors) -
toString
-