private static boolean moveToTrashOSX(File file){
  try {
    String[] command=moveToTrashCommand(file);
    ProcessBuilder builder=new ProcessBuilder(command);
    builder.redirectErrorStream();
    Process process=builder.start();
    consumeAllInput(process);
    process.waitFor();
  }
 catch (  InterruptedException err) {
    LOG.error("InterruptedException",err);
  }
catch (  IOException err) {
    LOG.error("IOException",err);
  }
  return !file.exists();
}

private static boolean moveToTrashOSX ( File file ) { try { String [ ] command = moveToTrashCommand ( file ) ; ProcessBuilder builder = new ProcessBuilder ( command ) ; builder . redirectErrorStream ( ) ; Process process = builder . start ( ) ; consumeAllInput ( process ) ; process . waitFor ( ) ; } catch ( InterruptedException err ) { LOG . error ( "InterruptedException" , err ) ; } catch ( IOException err ) { LOG . error ( "IOException" , err ) ; } return ! file . exists ( ) ; }
moves the given file or directory to trash .
