[Bug]: Deleting a library deletes all content within #1305

Closed
opened 2026-04-24 23:39:07 +02:00 by adam · 5 comments
Owner

Originally created by @Rade0nFighter on GitHub (Aug 4, 2023).

Describe the issue

When removing a library, all the contents of the corresponding folder on my hard drive was removed.

This resulted in lots of lost content which wasn't the intention, my assumption (given the lack of warning) was that this was simply to delete the Audiobookshelf library, not the underlying content.

If this is intentional, might I suggest having a checkbox that says "Would you like to also remove all library content (delete all files)"?

Excellent app by the way, just had a massive panic using it earlier :)

Steps to reproduce the issue

  1. Create a library pointing to an existing audiobooks/podcast folder
  2. (optional) Add content to it
  3. Delete the library
  4. Weep as your content has been hard deleted from your device

Audiobookshelf version

v2.3.3

How are you running audiobookshelf?

Docker

Originally created by @Rade0nFighter on GitHub (Aug 4, 2023). ### Describe the issue When removing a library, all the contents of the corresponding folder on my hard drive was removed. This resulted in lots of lost content which wasn't the intention, my assumption (given the lack of warning) was that this was simply to delete the Audiobookshelf library, not the underlying content. If this is intentional, might I suggest having a checkbox that says "Would you like to also remove all library content (delete all files)"? Excellent app by the way, just had a massive panic using it earlier :) ### Steps to reproduce the issue 1. Create a library pointing to an existing audiobooks/podcast folder 2. (optional) Add content to it 3. Delete the library 4. Weep as your content has been hard deleted from your device ### Audiobookshelf version v2.3.3 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:39:07 +02:00
adam closed this issue 2026-04-24 23:39:08 +02:00
Author
Owner

@advplyr commented on GitHub (Aug 4, 2023):

Deleting a library does not delete any contents, it only removes data from the database. It will delete the metadata folders from /metadata/item/{item id}/ if it exists because those are managed by Abs. Abs will not delete anything from your mapped media folders without a message saying it will do so.

I tested this and looked over the code again and I'm not sure how this could have happened for you. Is this reproducible for you if you create a test folder?

@advplyr commented on GitHub (Aug 4, 2023): Deleting a library does not delete any contents, it only removes data from the database. It will delete the metadata folders from `/metadata/item/{item id}/` if it exists because those are managed by Abs. Abs will not delete anything from your mapped media folders without a message saying it will do so. I tested this and looked over the code again and I'm not sure how this could have happened for you. Is this reproducible for you if you create a test folder?
Author
Owner

@Rade0nFighter commented on GitHub (Aug 7, 2023):

Apologies for the late response have been away over the weekend!

At the time this "happened" to me twice (restored from backup and re-tried) HOWEVER I cannot now reproduce this for the life of me.

Suspect this is best written off as me being an idiot with docker volumes, if it does happen I shall be sure to triple check my steps to reproduce.... Apologies for the inconvenience 🙈.

Super impressive app by the way, it's incredible what you've done - I'm on testflight and the iOS app works really well 💪💪.

@Rade0nFighter commented on GitHub (Aug 7, 2023): Apologies for the late response have been away over the weekend! At the time this "happened" to me twice (restored from backup and re-tried) HOWEVER I cannot now reproduce this for the life of me. Suspect this is best written off as me being an idiot with docker volumes, if it does happen I shall be sure to triple check my steps to reproduce.... Apologies for the inconvenience 🙈. Super impressive app by the way, it's incredible what you've done - I'm on testflight and the iOS app works really well 💪💪.
Author
Owner

@advplyr commented on GitHub (Aug 7, 2023):

No problem, you can also join the Discord or Matrix server if you have any questions. It's pretty active

@advplyr commented on GitHub (Aug 7, 2023): No problem, you can also join the Discord or Matrix server if you have any questions. It's pretty active
Author
Owner

@Clancey commented on GitHub (Jul 28, 2025):

This is 100% reproducable. Just hapened to me. Steps to reproduce:

Folder Structure:

  • AudioBooks
    • Author
      • Book1
        • book1.m4b
        • meta.json
      • Book2
        • book2.m4b
        • meta.json

I have the setting to save the meta.json and cover art to the book folder.

Now to reproduce. Add an m4b to the Author folder So it looks like:

  • AudioBooks
    • Author
      • Book1
        • book1.m4b
        • meta.json
      • Book2
        • book2.m4b
        • meta.json
      • book3.m4b
      • meta.json

Once book3 is added, do a force scan of the library. And it will think book 1 and 2 are gone.

So fix book 3

  • AudioBooks
    • Author
      • Book1
        • book1.m4b
        • meta.json
      • Book2
        • book2.m4b
        • meta.json
      • Book 3
        • book3.m4b
        • meta.json

At this point book 3 will show up as missing. If it isn't don't move the meta.json so it's still at the author root. Force scan. And it should show up missing.

Now you will have 2 copies of book 3 in your library.

If you delete the one marked as missing, it will delete the Author Folder. Removing missing items should be a local database function only. Deleting the folders should never happen.

@Clancey commented on GitHub (Jul 28, 2025): This is 100% reproducable. Just hapened to me. Steps to reproduce: Folder Structure: - AudioBooks - Author - Book1 - book1.m4b - meta.json - Book2 - book2.m4b - meta.json I have the setting to save the meta.json and cover art to the book folder. Now to reproduce. Add an m4b to the Author folder So it looks like: - AudioBooks - Author - Book1 - book1.m4b - meta.json - Book2 - book2.m4b - meta.json - book3.m4b - meta.json Once book3 is added, do a force scan of the library. And it will think book 1 and 2 are gone. So fix book 3 - AudioBooks - Author - Book1 - book1.m4b - meta.json - Book2 - book2.m4b - meta.json - Book 3 - book3.m4b - meta.json At this point book 3 will show up as missing. If it isn't don't move the meta.json so it's still at the author root. Force scan. And it should show up missing. Now you will have 2 copies of book 3 in your library. If you delete the one marked as missing, it will delete the Author Folder. Removing missing items should be a local database function only. Deleting the folders should never happen.
Author
Owner

@nichwall commented on GitHub (Jul 28, 2025):

If you delete the one marked as missing, it will delete the Author Folder. Removing missing items should be a local database function only. Deleting the folders should never happen.

Did you have the checkbox that says "Delete Item from filesystem" selected on the delete popup? If so, then it will also delete the files from your filesystem.

@nichwall commented on GitHub (Jul 28, 2025): > If you delete the one marked as missing, it will delete the Author Folder. Removing missing items should be a local database function only. Deleting the folders should never happen. Did you have the checkbox that says "Delete Item from filesystem" selected on the delete popup? If so, then it will also delete the files from your filesystem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1305