public static void delete(Path path){
  if (path != null) {
    path=path.toAbsolutePath();
    if (inTargetDir(path)) {
      try {
        IoUtil.delete(path);
      }
 catch (      IOException e) {
        printError("Unable to remove '" + path.toAbsolutePath() + "'",e);
      }
    }
 else {
      printError("Will not remove directory that is outside test target area: " + path);
    }
  }
}

public static void delete ( Path path ) { if ( path != null ) { path = path . toAbsolutePath ( ) ; if ( inTargetDir ( path ) ) { try { IoUtil . delete ( path ) ; } catch ( IOException e ) { printError ( "Unable to remove '" + path . toAbsolutePath ( ) + "'" , e ) ; } } else { printError ( "Will not remove directory that is outside test target area: " + path ) ; } } }
a method that will delete a file or folder only if it is within the ' target ' directory ( for safety ) . folders are removed recursively .
