# 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:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alienbogart](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@alienbogart](https://org-roam.discourse.group/u/alienbogart)\
**Post date:** [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/1 "2024-11-06T14:19:19Z")

</div>

It’s all pretty much right there in the title. I wish to be able to create a random note without having to think of a filename or anything at all. Just create the note with a single command and allow me to write in it. I can always rename it later on if I want. Is it possible to achieve that?

Thanks!

---

<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)))

```

---

<div class="post-metadata">

**Author:** ![maxxcan](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/maxxcan/32/626_2.png) [@maxxcan](https://org-roam.discourse.group/u/maxxcan)\
**Post date:** [November 8, 2024, 4:31pm UTC](https://org-roam.discourse.group/t/how-can-i-create-a-random-note-with-a-random-unique-file-name-in-one-go/3655/3 "2024-11-08T16:31:26Z")

</div>

that is very useful for me. Thank you very much.

---

<div class="post-metadata">

**Author:** ![alienbogart](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@alienbogart](https://org-roam.discourse.group/u/alienbogart)\
**Post date:** [November 9, 2024, 12:19am UTC](https://org-roam.discourse.group/t/how-can-i-create-a-random-note-with-a-random-unique-file-name-in-one-go/3655/4 "2024-11-09T00:19:41Z")

</div>

Thanks! I tested it and I think that will work just fine for what I want.
