Automating duplicacy with PowerShell scripts

Hey cristoph, maybe this’ll help you: https://bitbucket.org/thebestpessimist/duplicacy-utils

@TheBestPessimist: wow, thanks for sharing! That looks like what I was hoping to eventually come up with in a couple of years, when I have had the time to learn enough powershell to make things work! I’ll have to take a closer look at those scripts this weekend, but based on a quick look, it seems like you are following duplicacy’s decentral structure where all the preferences etc are stored in the repository base folder, right? My plan was to have a central folder with all settings so that there is only a .duplicacy file in the repository, which is pointing to the central folder. So this is probably something I’d want to add/modify.

I like the idea of setting the options once and for all in a config file. It’s a nice workaround for (part of) a feature request that I was contemplating submitting, i.e. that you can modify the default settings for things like chunk size.

@TheBestPessimist I added a link to your scripts to the wiki home page. Thanks!

@gchen excuse me (or better: DON’T), but i still am too lazy to make that promised wiki page with the utils on github. TeamFortress 2 just doesn’t let me do it :^).

@Christoph create me issues on bitbucket (or ask me to also provide a github if you don’t like bitbucket) with what you’d like to see modified, and i will see what could be done. What i think is that i like @gchen’s idea better, to just have the folder at the root of the repository, and make multiple Scheduled Tasks for everything.
Even that can be modified though, so that the script uses full folder paths, so it can be adapted for your needs.

@gchen: another request: is it possible that i get a mail from this forum when someone replies to me? I would answer much more quickly if i’d be notified (like on github) of everything. (hehe, this is also linked to the discourse forum request where the functionality exists)

@TheBestPessimist Thanks a lot for your kind offer to (possibly) accept “feature requests”. I have not used bitbucket so far and therefore have no reason to not like it. But I have been on Github for a while and always appreciate when software I’m interested in is hosted there, as I already know how it works (to some degree, at least). So if you don’t mind moving (or copying? if that makes sense) the repository to github, it would be great. I think it also makes sense considering that duplicacy is hosted there.

As for the forum request, you are not alone: see here: How about a discourse forum? and here: Search previously answered question. I’d like to use this opportunity to renew my offer of helping with setting up the forum. I really think the best time to make the move is about now. I know that for a busy person (as we all are), one big hurdle is to get started and find out what needs to be done and what potential problems might arise, because - obviously - only then can you actually plan the process. So that is why I’m offering my help (I have set up two forums myself and helped to set up one). My sense is that the demand for duplicacy will continue to grow and that also means more support requests. At some point, one person alone wont be able to handle those anymore, so it will be good to have an active community by then, that can help out.

The initial setup of the forum can be done in less than an hour (all you need is a VPS or equivalent, a (sub)domain, and a mailaccount for transactional mails at a provider like Mailgun or so), the main challenge is migrating the existing content to the new forum. But given the simplcity of this “forum” and the fact that posts are already in Markdown, it should not be the biggest of deals…

Here it is: https://github.com/TheBestPessimist/duplicacy-utils

Christoph, I really appreciate your offer. I’ll think about it and check how easy the transition will be and then let you know in a few days.

@TheBestPessimist, since you seem to know powershell well, can you explain why the duplicacy logs generated by my script above are sometimes immediately written to the logfile, and sometimes they only show up at the end of the job?

Today, for example, I immediately saw this in the logfile:

2018-02-01 21:47:30 *** Starting new backup of D:\christoph\work\dropbox ***
2018-02-01 21:47:33.240 INFO STORAGE_SET Storage set to P:\Backup\duplicacy-test\

while the remaining entries only appeared in the log after the job completed:

2018-02-01 21:47:30 *** Starting new backup of D:\christoph\work\dropbox ***
2018-02-01 21:47:33.240 INFO STORAGE_SET Storage set to P:\Backup\duplicacy-test\
2018-02-01 21:48:11.403 INFO BACKUP_START Last backup at revision 3 found
2018-02-01 21:48:11.420 INFO VSS_CREATE Creating a shadow copy for D:\
2018-02-01 21:50:01.956 INFO VSS_DONE Shadow copy {7499CB92-6982-4D79-B8E3-A503FEF9408D} created
2018-02-01 21:50:02.001 INFO BACKUP_INDEXING Indexing D:\christoph\work\dropbox
2018-02-01 21:50:03.294 INFO SNAPSHOT_FILTER Loaded 3 include/exclude pattern(s)
2018-02-01 21:51:59.466 INFO UPLOAD_PROGRESS Uploaded chunk 1 size 513595, 10KB/s 08:18:19 0.1%
2018-02-01 21:51:59.977 INFO UPLOAD_PROGRESS Uploaded chunk 2 size 298295, 15KB/s 05:14:54 0.2%
[...]

Hey,

I don’t know powershell that well. I am just curious how it works, so i chose it for a small project (afterall: doing real work is the best way to learn anything): duplicacy automation.

Anyhow: i think that your problem has something to do with buffering.

This is a hit i got: powershell - Is Out-Host buffering? - Stack Overflow (after way more searching that i expected).

Anyhow, in my opinion, you could try to write to a file using Out-File cmdlet (maybe that works).

Get-Date | Out-File -Append -FilePath a.txt

Thanks for your help with that. As far as I can tell from the Stackoverflow link, the best way forward is to use Start-Process instead of & because it takes control of the output (instead of letting the application (i.e. duplicacy) decide.

The only downside is that it does not allow to append an existing file, but the work-around for that seems to be here: https://stackoverflow.com/questions/8925323/redirection-of-standard-and-error-output-appending-to-the-same-log-file (have yet to try it)

No problem.
My question is however, why won’t you try and use my implementation for automatic duplicacy?
It’s already there (and working for my pc & laptop).

I intend to use it sometime in the future. The reasons why I don’t do it immediately are basically 1. it always takes time to learn and set up a new system, time that I currently don’t have. Had I seen this when I started with duplicacy in December, I would have immediately used it… 2. I prefer the centralized setup and need to adopt you scripts to that (or submit an issue/feature request for you, as discussed earlier). But that also requires time (which I don’t have).

And to cite a third reason for DIY:

doing real work is the best way to learn anything

meaning that getting my scripts to work (rather than just copying yours) is also a way of learn powershell…

I’ll get back with my feature request asap.

1 Like