vrtmrz / obsidian-livesync

MIT License
3.96k stars 134 forks source link

Old Folder Remains w/ Syncing after Renaming Folder #294

Open johnmarshall515 opened 9 months ago

johnmarshall515 commented 9 months ago

Hello. First, thank you for the amazing plugin. It is working pretty great except for one issue I have noticed.

When I rename a folder and sync, an empty folder with the old folder name remains on the device receiving the synced data. I have to manually delete the empty folder on that device as well as on my third device (the delete does not sync). I have the "Keep empty folder" option disabled on all devices, so I'm not sure why this is occurring. Also, it only seems to happen on the desktop clients (Mac and Windows). If my iPhone receives the synced data, the folder is deleted appropriately.

I have tried updating to 0.20.0, rebuilding the local and remote databases, and re-importing the config data by opening the setup URI again. But none have helped :(

Thank you again! @vrtmrz

vrtmrz commented 9 months ago

Hi! I am so honoured to hear that! and thank you for the detail. And, sorry for being delayed! I missed this. However, in my environment, it seems to work well. Deleting folders will not be performed if some files are left in the folder. (This count of leftover files is logged as files: n after xxx <- STORAGE). I am concerned that it happens only on the Desktop environment, is it possible that Thumbs.db or DS_Store exists in that folder? Looks like Obsidian counts this. Could you please check the folder which has been left over? Also, the log if you can, please.

johnmarshall515 commented 8 months ago

Thank you for the response.

There is no Thumbs.db, DS_Store, or any hidden files in the left over folder in Windows Explorer.

Here is a snippet of the log after I renamed the folder "1. 🕥 Temporary" to "1. 🕥 Temporary 2":

10/20/2023, 5:07:52 PM->LiveSync begin...
10/20/2023, 5:08:48 PM->Replication activated
10/20/2023, 5:08:48 PM->xxx <- STORAGE (deleted) 1. 🕥 Temporary/Quick Note.md
10/20/2023, 5:08:48 PM->files: 0
10/20/2023, 5:08:48 PM->All files under the parent directory ([object Object]) have been deleted, so delete this one.
10/20/2023, 5:08:49 PM->Entry removed:1. 🕥 Temporary/Quick Note.md (f:55b9bfa3a67bb171c8cb70d86a380f7ac259abc6c12d0c22a6e667b0a72996fa-688-f71719a09c404bd388616e372a084049)
10/20/2023, 5:08:49 PM->DB -> STORAGE (create,plain) 1. 🕥 Temporary 2/Quick Note.md
10/20/2023, 5:08:49 PM->Applied 1. 🕥 Temporary 2/Quick Note.md (f:aad152150db3aaa55ac974ef5fe3ca3de419cbe331e4c571c5f48ea7c8d8a63c:1-7b8f5acab943ad629d6f5e03f78fa04b) change...
10/20/2023, 5:09:37 PM->Replication closed
10/20/2023, 5:09:58 PM->Before LiveSync, start OneShot once...
10/20/2023, 5:09:58 PM->OneShot Sync begin... (pullOnly)
10/20/2023, 5:09:58 PM->Replication activated
10/20/2023, 5:09:58 PM->Replication completed
10/20/2023, 5:09:58 PM->LiveSync begin...

The result being that I now have 2 folders. An empty "1. 🕥 Temporary" folder and "1. 🕥 Temporary 2" folder with my note in it. @vrtmrz

vrtmrz commented 8 months ago

Thank you for the verbose log! It seems LiveSync has been detecting the empty folder correctly. However, actual deleting does not proceed. May I ask about your configuration of the Use the trash bin? Is it possibly disabled? If disabled, could you please try enabling it and then retry to see what happens?

johnmarshall515 commented 8 months ago

Yep enabling it fixed it! Interesting that only desktop requires it to be enabled when it works fine on mobile with it disabled.

Thank you