(require 'org)
(require 'org-id)

;; Ensure IDs are created and formatted as UUIDs
(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)
;; Actually, org-id-get-create automatically creates an ID if it does not exist.
;; We'll use UUIDs for IDs
(setq org-id-method 'uuid)

;; Iterate over all .org files in the notes/ directory
(let ((files (directory-files "notes/" t "\\.org$")))
  (dolist (file files)
    (with-current-buffer (find-file-noselect file)
      (goto-char (point-min))
      ;; Generate ID for the file itself
      (org-id-get-create t)
      (save-buffer)
      (kill-buffer))))
