Can I delete the contents within the "bak" folder

I have issues with using logseq on multiple devices (windows - mac - iOS) and when checking the BAK folder, a lot of duplicated entries are created in that folder.

As an easy way to clean up all those duplicated pages, can I just delete the back folder from time to time?

Hi, ran into the same issue. Here’s what I tried to do. I copied my project to a separate folder to save the data, just in case. After that, I deleted the bak folder from the project that Logseq is connected to and reindexed the graph. I haven’t found any problems with lost notes, so I see this as a solution for now.

On the other hand, the purpose of the bak folder is not quite clear to me yet, so maybe there are other more correct ways.

How did you solve your problem?

And please advise how do you synchronize the project on different operating systems (win and mac)? Did you have any problems with synchronization?

The bak folder contains backup files. These are created when there’s a conflict between the text file on disk and the page in the database—which mostly happens when using Logseq in combination with sync services like OneDrive, Dropbox, and iCloud.

You can safely delete the files in the bak folder, though they may come in handy if you want to roll back a file version.

What follows is a technical explanation that @Junyi_Du gave to me. You can ignore this section if you want.

There are three instances in which a file gets created in the bak folder:

  1. Logseq failed to write file to disk (folder doesn’t exist, not writable, etc.). logseq/handler.cljs at e4b71a4ccf5347c8278b89d4ed2c0e505785bf55 · logseq/logseq · GitHub
  2. On writing to file, Logseq finds out the file on disk is not matched with the structure in Logseq. Some modification may happen to the file, and Logseq didn’t capture it.
    logseq/node.cljs at fa7611bbae3d2875317bfbd5b07d94af1b33c52d · logseq/logseq · GitHub
  3. Logseq notices a third party has modified the file on disk. logseq/watcher_handler.cljs at 658d1d315a04ecff499b7458e479f94baee8b18b · logseq/logseq · GitHub
3 Likes