# Bulk Rename Attachments with File name prefix

**URL:** <https://forum.obsidian.md/t/bulk-rename-attachments-with-file-name-prefix/85753>\
**Category:** Help\
**Created:** [July 22, 2024, 7:25pm UTC](https://forum.obsidian.md/t/bulk-rename-attachments-with-file-name-prefix/85753 "2024-07-22T19:25:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy4222](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@andy4222](https://forum.obsidian.md/u/andy4222)\
**Post date:** [July 22, 2024, 7:25pm UTC](https://forum.obsidian.md/t/bulk-rename-attachments-with-file-name-prefix/85753/1 "2024-07-22T19:25:37Z")

</div>

Trying to rename all my note attachment and prefix them with file name and a random number (whatever makes them unique).

I have hundred of notes, How can I accomplish this?

- Bulk rename of attachments doesn’t work in this: [GitHub - trganda/obsidian-attachment-management: Attachment Management of Obsidian](https://github.com/trganda/obsidian-attachment-management)
- Doesn’t support bulk renaming, only supports future pasted images: [GitHub - reorx/obsidian-paste-image-rename: Renames pasted images and all the other attachments added to the vault](https://github.com/reorx/obsidian-paste-image-rename)

Could anyone please suggest a solution?

---

<div class="post-metadata">

**Author:** ![Yurcee](https://forum.obsidian.md/user_avatar/forum.obsidian.md/yurcee/32/53074_2.png) [@Yurcee](https://forum.obsidian.md/u/Yurcee)\
**Post date:** [July 22, 2024, 10:07pm UTC](https://forum.obsidian.md/t/bulk-rename-attachments-with-file-name-prefix/85753/2 "2024-07-22T22:07:45Z")

</div>

i don’t know about plugins… this is an outside of obsidian job…

we need to rename actual images and their references in the markdown file, making sure the changes happen in a loop

some information is needed:

- OS
- folder of attachments (consistently in folder below markdown file’s level or elsewhere or completely random)
- is `filename_image1.jpg` or `such is my filename_image2.png` or `such_is_my_filename_image3.gif` or `suchismyfilename_image45565.png` preferred – asking because down the road it’s better to not have any spaces between strings in filenames and image numbering with suffixes \_image1, etc. seem straightforward and logical – if anyone wants to help here they need to cater to anybody’s needs for posterity and any participants here should vote for the most logical naming conventions
  - obsidian doesn’t really have a problem with spaces in filenames but we need compatibility with any markdown app

---

<div class="post-metadata">

**Author:** ![andy4222](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@andy4222](https://forum.obsidian.md/u/andy4222)\
**Post date:** [July 22, 2024, 10:40pm UTC](https://forum.obsidian.md/t/bulk-rename-attachments-with-file-name-prefix/85753/3 "2024-07-22T22:40:08Z")

</div>

- macOS 14.5 (23F79)
- `attachments` folders. This resides inside each folder - each folder has it’s own `attachments`
- attachments names have spaces in them. Very arbitrary. My preferred attachment name would be `<notename>_<random number/date>`

---

<div class="post-metadata">

**Author:** ![Yurcee](https://forum.obsidian.md/user_avatar/forum.obsidian.md/yurcee/32/53074_2.png) [@Yurcee](https://forum.obsidian.md/u/Yurcee)\
**Post date:** [July 22, 2024, 10:55pm UTC](https://forum.obsidian.md/t/bulk-rename-attachments-with-file-name-prefix/85753/4 "2024-07-22T22:55:04Z")

</div>

okay, so shell script or python it will be (i prefer the latter but it needs an env setup)  
attachments is straightforward  
date suffix is doable based on creation date

1am here so my time is up for today… maybe tomorrow…?

---

<div class="post-metadata">

**Author:** ![Yurcee](https://forum.obsidian.md/user_avatar/forum.obsidian.md/yurcee/32/53074_2.png) [@Yurcee](https://forum.obsidian.md/u/Yurcee)\
**Post date:** [July 23, 2024, 5:52pm UTC](https://forum.obsidian.md/t/bulk-rename-attachments-with-file-name-prefix/85753/5 "2024-07-23T17:52:39Z")

</div>

…found another problem…

…post deleted…

over and out…sorry…

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [October 21, 2024, 5:53pm UTC](https://forum.obsidian.md/t/bulk-rename-attachments-with-file-name-prefix/85753/6 "2024-10-21T17:53:14Z")

</div>

Closed on October 21, 2024, 5:53pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
