code: public static void delete(File file) throws IOException{
          if(!file.exists())
              return;
  
          if(file.isFile()){
              if(!file.delete())
                  throw new IOException("couldn't delete file :"+file);
          }else{
              try{
                  WalkerUtil.walk(new PreorderWalker<File>(file, FileNavigator.INSTANCE), new Processor<File>(){
                      @Override
                      public boolean preProcess(File file, Path path){
                          return true;
                      }
  
                      @Override
                      public void postProcess(File file, Path path){
                          try{
                              if(!file.delete())
                                  throw new IOException("couldn't delete file :"+file);
                          }catch(IOException ex){
                              throw new RuntimeException(ex);
                          }
                      }
                  });
              }catch(RuntimeException ex){
                  if(ex.getCause() instanceof IOException)
                      throw (IOException)ex.getCause();
                  else
                      throw ex;
              }
          }
      }
docs: deletes specified file or directory
  if given file/dir doesn't exist, simply returns