# How can I create a random note with a random unique file name in one go?

**URL:** <https://org-roam.discourse.group/t/how-can-i-create-a-random-note-with-a-random-unique-file-name-in-one-go/3655>\
**Category:** How To\
**Created:** [November 6, 2024, 2:19pm UTC](https://org-roam.discourse.group/t/how-can-i-create-a-random-note-with-a-random-unique-file-name-in-one-go/3655 "2024-11-06T14:19:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [November 6, 2024, 8:03pm UTC](https://org-roam.discourse.group/t/how-can-i-create-a-random-note-with-a-random-unique-file-name-in-one-go/3655/2 "2024-11-06T20:03:36Z")

</div>

Is this what you are going for?

```emacs-lisp
(defun my/create-new-note ()
  "Create a new note file in `org-roam-directory'."
  (interactive)
  (let* ((time-string (format-time-string "%Y%m%dT%H%M%S"))
         (extension "org")
         (file-base-name (concat time-string "." extension))
         (file-name (expand-file-name file-base-name org-roam-directory)))
    (find-file file-name)
    ;; In the new buffer
    (insert (format "#+title: %s\n\n" time-string))
    (org-id-get-create)
    (end-of-buffer)))

```

---

_[View the full topic](https://org-roam.discourse.group/t/how-can-i-create-a-random-note-with-a-random-unique-file-name-in-one-go/3655)._
