com.evanmclean.evlib.io
Class RecursiveDelete

java.lang.Object
  extended by com.evanmclean.evlib.io.RecursiveDelete

public class RecursiveDelete
extends Object

Delete entire contents of a folder, with optional error handling.

Author:
Evan McLean McLean Computer Services (see the overview for copyright and licensing.)

Constructor Summary
RecursiveDelete()
          Instantiates a recursive deleter that will continue even if it has an error during file deletion.
RecursiveDelete(boolean continue_on_error)
          Instantiates a recursive deleter.
 
Method Summary
 boolean deleteAll(File base)
          Deletes the specified file/directory, plus any sub-directories.
 boolean deleteChildren(File base)
          Perform recursive delete of all children of the specified directory.
protected  void errorHandler(File base)
          Can be overridden to handle errors.
 boolean isContinueOnError()
          Indicates if we continue despite any errors that occurred during file copying.
 void setContinueOnError(boolean continue_on_error)
          Indicates if we continue despite any errors that occurred during file copying.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecursiveDelete

public RecursiveDelete()
Instantiates a recursive deleter that will continue even if it has an error during file deletion.


RecursiveDelete

public RecursiveDelete(boolean continue_on_error)
Instantiates a recursive deleter.

Parameters:
continue_on_error - Indicates if we continue despite any errors that occurred during file deletion.
Method Detail

deleteAll

public boolean deleteAll(File base)
Deletes the specified file/directory, plus any sub-directories.

Parameters:
base -
Returns:
False if any errors.

deleteChildren

public boolean deleteChildren(File base)
Perform recursive delete of all children of the specified directory.

Parameters:
base -
Returns:
False if there was an error deleting any file at all.

isContinueOnError

public boolean isContinueOnError()
Indicates if we continue despite any errors that occurred during file copying. The default to true.

Returns:
The current setting.

setContinueOnError

public void setContinueOnError(boolean continue_on_error)
Indicates if we continue despite any errors that occurred during file copying. The default to true.

Parameters:
continue_on_error -

errorHandler

protected void errorHandler(File base)
Can be overridden to handle errors.

Parameters:
base - The file that caused the error.