code: public void clearDirectory(File directory) {
          if (directory.exists()) {
              for (File file : directory.listFiles()) {
                  file.delete();
              }
          }
      }
docs: Warning: Deletes the content of a directory.
  This is an I/O operation and this method executes in the main thread, so it is recommended to
  perform the operation using another thread.
  
  @param directory The directory which its content will be deleted.