code: public static boolean deleteDirectoryContents(final File dir) {
          if (dir == null || !dir.isDirectory()) {
              return false;
          }
  
          File[] files = dir.listFiles();
          for (final File file : files) {
              if (file.isDirectory()) {
                  if (!deleteDirectory(file)) {
                      return false;
                  }
              } else {
                  if (!file.delete()) {
                      return false;
                  }
              }
          }
  
          return true;
      }
docs: Recursively deletes all files and folders within the directory
  <tt>dir</tt>.
  
  @param dir {@link File}, the directory to empty contents for
  @return boolean determines whether or not the delete was successful,
  <tt>true</tt> if success, <tt>false</tt> otherwise