[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Saving files in two drives

Reply to note from Myron Gochnauer  Sat, 27 Feb 2016 14:39:04


> As far as I know, no other developer picked up the idea. Surely
> the basic idea would be a pretty simple thing to create, even
> without a command line.

True. Any program capable of passing the name of the current file as an
argument to a BATch file can be made to save that file to multiple
drives/directories. Here's how.

First, create a BATch file like the following; list the backup directories
in the line starting with "set dirlist":

:: ------------------
:: Save backup copy of file to multiple directories
@echo off
if %1! == ! exit
if not exist %1 exit

:: >>>>>>>> Set backup directories immediately below <<<<<<<<
set dirlist=d:\dir1 e:\dir2 f:\dir3

for %%d in (%dirlist%) do if exist %%d copy/y %1 %%d > nul
set dirlist=
:: ------------------

Then, for example, in Word and other MS Office applications, you can create
a VBA macro BackSave as follows:

Sub BackSave()
' Save current file and run BACKSAVE.BAT to save to alternate locations
Dim R
R = Shell("cmd.exe /c d:\path\BACKSAVE.BAT " & ActiveDocument.FullName, 6)
End Sub

(Of course, substitute the actual path to BACKSAVE.BAT for "d:\path\".)
This macro can be assigned to Ctrl-S in place of the normal Save function,
or to another key.

Needless to say, you can do the same in XyWrite:

BX saQ2 BX dos/nv/x/z /c cmd.exe /c d:\path\BACKSAVE.BATQ2 ;*;

Carl Distefano