husjon / obsidian-file-cleaner-redux

A plugin for Obsidian to help clean up files in your vault
MIT License
28 stars 2 forks source link

Any idea what could be the cause, all attachments were send to trash for 2nd time #55

Open itoldusoandso opened 3 months ago

itoldusoandso commented 3 months ago

I know there risk with plugins. and I do keep backups. The only destructive plugins I have:

  1. Attachment Management

  2. File Cleaner Redux

  3. Remotely Save

    • If note gets renamed, it will rename the attachment, create new subfolder under Attachments folder matching the modified note name, then move the attachment to that new folder, following that will delete the old folder because it was empty (since it was named after the old name of the note and all the attachments moved to another folder so it became empty)

2 - File Cleaner Redux - by mistake I had disabled deletion protection (100% allowed); I allowed deleting files without confirmation (hah, that is way I didn't see when it started deleting all attachments).

3 - Remotely Save bidirectional sync via dropbox, it had a setting to delete empty folders (disabled that setting now, in case that was causing an issue, not sure); Also does sync of Obsidian config files .obsidian folder

This is a gimmicky setup. If things can go wrong - they will go wrong, as the saying goes.

I wish only Obsidian included the functionality of at least the first 2 addons included with the application. Because who knows what is going on when things deleted in bulk like this happened already 2 times and can't figure out what is going on.

Just wondering what could be the potential issues. I don't know how Obsidian operates. Maybe the plugins get into cross hair because they are running at the same time?

Things I am going to try:

Question - does File Cleaner Redux setting contain any data that is meaningful to determine what needs to be deleted and what not? Or does the plugin read the Obsidian database every time it is going to do something?

Otherwise I don't know what else should I do.

husjon commented 3 months ago

Hi, glad you had backups :)

I'm not entirely sure but there might have been some interaction between File Cleaner Redux and Remotely Save.

I wish only Obsidian included the functionality of at least the first 2 addons included with the application. Because who knows what is going on when things deleted in bulk like this happened already 2 times and can't figure out what is going on.

As you mention Remotely Save is set to run 1 second after startup, this is also what File Cleaner Redux does (currently hardcoded to 1 second), so might want to try to extend Remote Save slightly. These could clash if both are trying to delete folders during startup.

Regarding File Cleaner Redux, it runs only once on startup but can be triggered manually as needed.

When it comes to syncing, I do not have experience with Remotely Save as I have my main Obsidian vault handled by Syncthing. In Syncthing, I've set it to sync the entire vault, including the Obsidian settings folder.

Question - does File Cleaner Redux setting contain any data that is meaningful to determine what needs to be deleted and what not? Or does the plugin read the Obsidian database every time it is going to do something?

File Cleaner Redux gets everything from Obsidians metadata cache only when it runs. It gets a snapshot as soon as the cleanup is initiated, then works through that snapshot.

The only file of relevance for the plugin is in the .obsidian/plugins/file-cleaner-redux/data.json which contains all User Settings. If this file is not synced and the plugin is run on another device, it runs with default settings, which are to remove only empty markdown files.

Hope this helps.