Windows BAT script to archive copies of your paper or novel

By Chad Kluck on

If you have a very important document that you've been spending weeks, months, years, or even a decade on, you might want to back it up. No, you WANT to back it up.

Maybe you have saved extra copies, maybe you've backed it up so many times in so many places that you get confused as to where the current one is, what naming convention you use, and which flash drive actually has a copy from six months ago that you'd like to pull up again because that's when you deleted a few pages that you really want to reincorporate.

This post, and the batch script below is for students, writers, and the like.

To get started you'll need a Windows machine, a Dropbox account with the desktop app installed, a Google Drive account with the desktop app installed, and an external or network attached hard drive.

If you don't have all of those, or if you have a different set-up, that's okay, just modify the code below to fit your needs. By running the script "as is" it will copy a current, working copy to Google Drive, Dropbox, and attached storage device as well as a dated (with a date in the file name) archive copy that you can easily call back up if needed.

@echo off

REM \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
REM \* Single Document Back-Up
REM \* Chad Leigh Kluck - chadkluck.net
REM \* February 10, 2016
REM \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

REM \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
REM \* SET CUSTOM VARIABLES 
REM \* We set variable to name the source and archive
REM \*   
REM \* docExt=\[the extension of the doc\] 
REM \* docName=\[the name without the extention\]  
REM \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

set docExt=.docx
set docName=MyNovel

set sourceCopy=\\\\drobo\\Documents\\Chad\\%docName%%docExt%

set archiveGoogle=%USERPROFILE%\\Google Drive\\Archive\\
set archiveDropBox=%USERPROFILE%\\Dropbox\\Archive\\
set archiveDrobo=\\\\drobo\\Documents\\Chad\\Archive\\

REM \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
REM \* END CUSTOM VARIABLES
REM \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

REM \* Formulate the name of the archive document "MyNovel 2016-02-16.docx"
set archiveName=%docName% %date:~-4,4%-%date:~-10,2%-%date:~-7,2%%docExt%
set fullDocName=%docName%%docExt%

echo.
echo Saving current copy and dated archive copy to Google Drive...
COPY /V /Y /Z "%sourceCopy%" "%archiveGoogle%%fullDocName%"
COPY /V /Y /Z "%sourceCopy%" "%archiveGoogle%%archiveName%"

echo.
echo Saving current copy and dated archive copy to NAS...
COPY /V /Y /Z "%sourceCopy%" "%archiveDrobo%%fullDocName%"
COPY /V /Y /Z "%sourceCopy%" "%archiveDrobo%%archiveName%" 

echo.
echo Saving current copy and dated archive copy to Dropbox...
COPY /V /Y /Z "%sourceCopy%" "%archiveDropBox%%fullDocName%"
COPY /V /Y /Z "%sourceCopy%" "%archiveDropBox%%archiveName%"

echo.
pause

Just change the file paths to reflect your own, save it in a "archive-this.bat", place in the same directory your document or on your desktop so you never forget, and you're set with local and off-site (cloud) archives!

You'll notice that I list \\Drobo as my Network Attached Storage, this could just as easily be C:\

Have fun and remember, this should be used in conjunction with regularly scheduled, automatic on and off-site back-ups!

Tags