[FEATURE REQUEST] Back up using a regular folder instead of .zip
I'm hoping for a toggle which gives the user the ability to have the created backup files be regular folders instead of a compressed archive. In other words, a 1-to-1 copy of the Obsidian folder. The use case for this is to allow deduplication tools like (Restic incremental backups) to play nicely with Local Backup. Currently the issue is that even if I change one character in one note in my 100MB vault, the compressed archive file will be significantly different than the previous one in the eyes of deduplication algorithms, leading to inefficient deduplication, in this case an extra 20MB added to my Restic repo instead of 1KB.
References, further reading:
https://restic.net/blog/2015-09-12/restic-foundation1-cdc/
https://forum.restic.net/t/noob-question-about-how-restic-backups-work/4137/2
https://joshleeb.com/posts/content-defined-chunking.html
Interesting idea, I could have a use of that too. Thank you for the information about restic, I did not know it.
As a workaround, maybe specify an external archiver (zip) and provide a script as the executable of the archiver. The script must accept/ignore the same parameters but do a create subdirectory (without the extension) and do a recursive copy. You may want to use the local-backup built-in mechanism to ignore files rather than trying to implement it in your script. You can look around line 200 of main.ts for the code used to call the archiver (copied below) to guess the arguments. If this work, maybe it would be nice to add a 'script' mode to local-backup, to request backup via a script. The script could be adapted by the user for his OS, destination and preferences. you could even spawn a dedictaed restic command for you Vault is so desired).
if (this.settings.callingArchiverStatus) {
backupFilePath = join(
savePathValue,
`${fileNameWithDateValues}.${this.settings.archiveFileTypeValue}`
);
await this.utils.createFileByArchiver(
this.settings.archiverTypeValue,
archiverPathValue,
this.settings.archiveFileTypeValue,
vaultPath,
backupFilePath,
this.settings.customizedArguments
);
} else {
await this.utils.createZipByAdmZip(vaultPath, backupFile
I have implemented this functionality, allowing to select between internal zip, external archiver or a script. This seems to work on windows both cmd and powershell 7, should work on unix. I will make it availlable on a clone likely tomorrow, and if there is an interest I can make a pull request (there are new settings and I have adepted the readme). This is interesting as in addition to make a simple copy, we can for example maintain an image with robocopy or do a zip and then an ftp or other similar functionalities.
You can try the proposal at https://github.com/bitli/obsidian-local-backup/tree/backup-by-script.
See the README for details. I’ll test it for a few days and review the code.
It supports backup scripts for Windows and Unix, for example using tar, robocopy, or restic.
I use it for frequent backups to protect against mistakes or reversals. Restic for a local backup is very efficient for this.
To test it, copy your vault elsewhere and replace the existing main.js in .../.obsidian/plugins/obsidian-local-backup with this file: main.js.
No responsibility taken if this script causes the sun to go supernova or other issues.