Feature Request: Allow a [replicate] variable for the right-side path

Discuss new features and functions
User avatar
Radish
Posts: 104
Joined: 8 Mar 2017

Post by Radish • 10 Jun 2019, 15:07

Got this idea from a recent post in the Help section of the forums.

Say you want to setup a situation in which you want end up with the following right-side folder:

Left-side = c:\users\fred\documents\directorytobackup
Right-side = d:\documents\users\fred\documents\directorytobackup

However, you want the right-side path to be created automatically by FFS, not specified manually, using the left-side path as the right-side path with the exception of the drive letter/label. So to achieve this allow a, let's call it, a [replicate] variable for the right-side path. That variable would operate in the same way the "Variable Drive Letters" variable works. So, for example, the above situation could be dealt with doing this:

Left-side = c:\users\fred\documents\directorytobackup
Right-side = d:\[replicate]

Where the variable [replicate] resolves to: Make the path to the right-side backup folder identical to the left-side path (with the exception of the drive letter/label, which the user has to specify himself).

This could be usefully extended to also allowing a "Variable Drive Letter" in the right-side path, for example:

Left-side = c:\users\fred\documents\directorytobackup
Right-side = [FlashDrive]\[replicate]

Hope I've explained this okay. It would be a useful variable to be able to use.

User avatar
Plerry
Posts: 633
Joined: 22 Aug 2012

Post by Plerry • 11 Jun 2019, 08:22

Your use case is quite specific, in that you intend to replicate the full path (with the exception of the drive letters).
There may be other use cases where it desirable to duplicate part of the full path (which may still be the full path).
However, that requires means to indicate the start and end of the part of the path to be replicated.
Sort of a back referencing as known from regular expressions, but then cross-variable …
And therefore instantly becomes very complex.

The simplest way to achieve what you want may be to invoke FFS from a *.bat or *.cmd script, and use variables to define the left and right path, in part or in whole.
See the Macro section of the Manual.