Accessing setting for Default File Size in batch file?


Author
Message
David
David
New Member
New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)
Group: Forum Members
Posts: 20, Visits: 74
One of Reflect Defaults you can set is a fixed file size, which I use.  Is there any way to access that setting in a Reflect batch file?  I have it hard-coded in a vbs file called from this batch file, and it would be good programming practice to read that setting and then use it as an argument in calling the vbs file.

jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)
Group: Forum Members
Posts: 14K, Visits: 85K
The file split setting and the file size are both stored as values in the XML definition file that describes the entire job.  If you start a Reflect job using a batch file or VB script, the script just has a line that calls Reflect and specifies the definition file of the desired job as a parameter, which tells Reflect to start and immediately run the job described in that definition file.  To my knowledge there isn't a way to specify job options as script parameters.  The only exception is Full/Inc/Diff backup types, because the backup type is not an inherent configuration option of the job itself, but rather a per-execution decision for each iteration of a given job with fixed settings.  So unless you've got VBS that actually rewrites the XML file based on parameters you feed it, I'm not even sure what you hard-coded into your current VBS file for this, or for that matter why you're using a batch file to call a VBS file since a VBS file can be called directly.

If you really want to be able to adjust the file split setting for different executions of the same definition file, I actually created a script that was capable of modifying the XML file prior to starting Reflect in order to achieve something like this.  It change was for a different setting to facilitate a different use case, but it could be adapted for this.  The catch is that I did it in PowerShell since I have no experience with VBS or any interest in learning it at this stage since PowerShell seems so much cleaner to me.

Edited 23 September 2019 5:13 PM by jphughan
David
David
New Member
New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)
Group: Forum Members
Posts: 20, Visits: 74
jphughan - 23 September 2019 5:06 PM
The file split setting and the file size are both stored as values in the XML definition file that describes the entire job.  If you start a Reflect job using a batch file or VB script, the script just has a line that calls Reflect and specifies the definition file of the desired job as a parameter, which tells Reflect to start and immediately run the job described in that definition file.  To my knowledge there isn't a way to specify job options as script parameters.  The only exception is Full/Inc/Diff backup types, because the backup type is not an inherent configuration option of the job itself, but rather a per-execution decision for each iteration of a given job with fixed settings.  So unless you've got VBS that actually rewrites the XML file based on parameters you feed it, I'm not even sure what you hard-coded into your current VBS file for this, or for that matter why you're using a batch file to call a VBS file since a VBS file can be called directly.

If you really want to be able to adjust the file split setting for different executions of the same definition file, I actually created a script that was capable of modifying the XML file prior to starting Reflect in order to achieve something like this.  It change was for a different setting to facilitate a different use case, but it could be adapted for this.  The catch is that I did it in PowerShell since I have no experience with VBS or any interest in learning it at this stage since PowerShell seems so much cleaner to me.

Ah, the XML file, I can read it.  I use a bat file to do the backup, where I do not limit the file size (I want the ability to do incremental and differential backups).  Once the backup is complete, the bat file calls my vbs file, which splits the backup file and puts the file's pieces into my OneDrive folder (OneDrive will not sync files larger than 15GB, so that's my default file size).  I'll look into how to parse text files in vbs or bat files (probably a lot easier in vbs).

jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)
Group: Forum Members
Posts: 14K, Visits: 85K
So after your batch file backup completes, does your VBS file tell Reflect to run a completely new backup job that has file splitting enabled?  Or does the VBS file call some other utility to split the existing backup file up into pieces?  If it's the latter, then the Reflect's file splitting setting has nothing to do with whatever you're doing with some other application afterward, so there wouldn't be anything to do on Reflect.  If on the other hand you're having Reflect perform two different backups with two different file split settings, then the easiest solution would probably be to just have two different XML files.  Create the first one with no file splitting enabled, then in the Backup Definition Files tab, right-click it and select Duplicate.  Open the settings of the new copy of that file and set your file splitting as desired, and optionally change the destination folder, schedule, retention policy, etc.  At that point, you might not even need the batch file or VBS file anymore.  You could just use Reflect and Task Scheduler.  Or if you wanted to be able to perform backups on-demand, you could use a desktop shortcut rather than a batch file.  To do that, right-click the definition file you want a shortcut for and click "Create Desktop Shortcut".

David
David
New Member
New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)
Group: Forum Members
Posts: 20, Visits: 74
jphughan - 23 September 2019 9:11 PM
So after your batch file backup completes, does your VBS file tell Reflect to run a completely new backup job that has file splitting enabled?  Or does the VBS file call some other utility to split the existing backup file up into pieces?  If it's the latter, then the Reflect's file splitting setting has nothing to do with whatever you're doing with some other application afterward, so there wouldn't be anything to do on Reflect.  If on the other hand you're having Reflect perform two different backups with two different file split settings, then the easiest solution would probably be to just have two different XML files.  Create the first one with no file splitting enabled, then in the Backup Definition Files tab, right-click it and select Duplicate.  Open the settings of the new copy of that file and set your file splitting as desired, and optionally change the destination folder, schedule, retention policy, etc.  At that point, you might not even need the batch file or VBS file anymore.  You could just use Reflect and Task Scheduler.  Or if you wanted to be able to perform backups on-demand, you could use a desktop shortcut rather than a batch file.  To do that, right-click the definition file you want a shortcut for and click "Create Desktop Shortcut".

The only thing the vbs file does is launch a program (http://www.fastfilejoiner.com) to split the file.
Writing code to read the default file size from the XML is not worth the effort., close this discussion thread.

jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)
Group: Forum Members
Posts: 14K, Visits: 85K
If you ever change your mind and are willing to consider PowerShell, here's all it takes:

$FileSize = ([xml](Get-Content "C:\MyDefinitionFile.xml")).backup_definition.properties.maxfilesize


The value is always in MB.  Or if you want it in slightly more readable form:

[xml]$DefinitionFile = Get-Content "C:\MyDefinitionFile.xml"
$FileSize = $DefinitionFile.backup_definition.properties.maxfilesize


Edited 24 September 2019 1:38 AM by jphughan
David
David
New Member
New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)New Member (22 reputation)
Group: Forum Members
Posts: 20, Visits: 74
jphughan - 24 September 2019 1:34 AM
If you ever change your mind and are willing to consider PowerShell, here's all it takes:

$FileSize = ([xml](Get-Content "C:\MyDefinitionFile.xml")).backup_definition.properties.maxfilesize


The value is always in MB.  Or if you want it in slightly more readable form:

[xml]$DefinitionFile = Get-Content "C:\MyDefinitionFile.xml"
$FileSize = $DefinitionFile.backup_definition.properties.maxfilesize


Cool.  Have not learned PowerShell, what you just showed me makes me consider it.
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)Macrium Evangelist (22K reputation)
Group: Forum Members
Posts: 14K, Visits: 85K
Well if all you need to do with your current VB script is start an application, that should be pretty straightforward.  As an example, suppose running your file splitter application on the command line required this syntax:

C:\MyApp\FileJoiner.exe /source:C:\MyFile.bak /destination:D:\MyBackups /filesize:15000


In PowerShell, that command would be:

Start-Process -FilePath "C:\MyApp\FileJoiner.exe" -ArgumentList "/source:C:\MyFile.bak /destination:D:\MyBackups /filesize:15000"


You could optionally add a "-Wait" parameter at the end of the Start-Process line, which will cause the script to wait until the process you started actually exits.  If you need to use double quotes within the argument string itself because some argument value has a space, you'll need to escape those double quotes with the backtick character (`) so that they don't terminate the overall ArgumentList parameter value.  And if you want to specify the filesize argument as a variable that you had previously captured using the script I provided above, the last part of that argument string would read "/filesize:$FileSize", for example.  Happy scripting if you decide to look into it! Smile

Edited 24 September 2019 3:23 AM by jphughan
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Login

Explore
Messages
Mentions
Search