How do I use Windows environment variables, for example, in the send-mail-subject section.
What I want to do is; to know which PC the mail came from. I might also want to use it for other purposes.
Hi @inoloni, welcome to the forum!
Unfortunately, I don’t think you can access general environment variables within Duplicati. You might be able to “stuff” %DUPLICATI__xxxx_yyyy% variables in a
--run-script-before file, but it probably wouldn’t get you to where you want to be.
But that sounds to me like a pretty nice feature to request…
Hi @JonMikelV, thank you.
This place is beautiful.
I like Duplicati. I am trying to spread it in our business. This feature will be very useful for people like me. I would also like to be able to use this feature in the backup sources section.
Thank you! We’ll look at how it might be implemented, but can’t offer any estimates of if or when it might show up.
How are you thinking of using such a feature? Depending on what you have in mind that might already be supported or it might be a bad idea (from a backup history point of view)…
I am preparing to distribute Duplicati to 100 computers, so I want to create a generic configuration for all computers;
- Dulicati will work with the System user as a service to prevent the problem of authority.
- There will be two spare profiles, for documents and email.
- There will be two sources in the documents profile, the Desktop and the Documents folder. For now I have not been able to make a general setting there, so I need to adjust it one by one after installation. (I want to use the environment variables for all currently active paths to be backed up, eg “c:\users%ACTIVEUSER%\Desktop”)
- There is a similar situation for the email profile.
- I installed Duplicati in a clean system to meet these requirements, I made profile settings and general settings as I wanted.
I copied the database in this state.
I prepared a new Duplicati setup project and added this ready database. So I got the customized MSI file, ready to publish.
Well, “%ACTIVEUSER%” would be the account under which Duplicati is running. So if you have it running as a service it would be something like SystemUser or Administrator, so probably not the user folder you want backed up.
It might work better of you set your source to C:\Users then used filters to exclude anything that’s not Desktop, Documents, or your email path (or include filters to grab only those). You could even exclude known users you might not want, such as Public or Administrator.
I thought of it before, I do not want to have the possibility of other passive users backup. And I am not successful with regex. If you can write an example for Desktop, it is useful. Maybe I can figure out a way to turn it into what I need. This is C plan.
Now at plan B time, I will create all the paths to backup with Symbolic Link in a folder, then I will try to backup that single folder. I think of ways to create these links automatically. I guess it will not be too hard.
Sorry for my English, I use Google Translate.
That works - I believe other users have also done that. Just make sure your
--hardlink-policy parameter is set appropriately.
This is done, but is there a way to set the target path like this? \XXX\[variable]
[Variable] should contain unique and specific results on each PC. It would be nice to have a computer name or username
You could probably use a
--run-script-before call to specifically set the Source folders or Filters on each machine. Just about any Duplicati parameter can be configured in those scripts by setting %DUPLICATI__parameter_name% in the script.
So if you wanted to include ONLY user inoloni, then in your
--run-script-before you could do something like:
Note that DUPLICATI is followed by TWO “" (underscores) and any “-” (dash) in “parameter-name” gets replace with "” (underscore).
However, depending on how many users you’ve got it might be easier to configure a “generic” backup with an include Filter that supports ALL potential users you care about. That way if user inoloni happens to log into two different computers, their data would be backed up on both of them.
If you want to try that, then you could go to step 3 (Source Data), open the Filters section, and add one or more “Include expression” or “Include regular expression” settings. With “Include regular expression” if you wanted only Documents and Desktop for users UserA, UserB, and UserC you’d want to set a value something like this.
- the “.:” at the beginning says use it can use any drive letter (in case your Users folder isn’t stored on drive C:slight_smile:
- the “\Users\” says look in the Users folder (and yes, the double “\” is correct)
- the “(UserA|UserB|UserC)” says “UserA OR UserB OR UserC” (using “|” inside a parenthesis means OR)
- the “(Desktop|Documents)” is like the previous one and says “Desktop OR Documents”
- the ending “\” says “these are folders, not files”
If you wanted to do the same (only Desktop and Documents) for ALL users you could use an “Include regular expression” of:
- everything is the same as above except instead of “Users” the
[^\\]*says “anything that is NOT a slash” (the
^carrot at the start of brackets means NOT and the
*outside of the brackets means 0 or more characters)
For more info on Filters see: