The following use case details the steps for automating a backup job with compression and encryption using 7zip.
First, install the 7zip application. 7zip is free and can be downloaded here.
Once you have 7zip installed, add the directory that contains the 7zip executable to your %PATH% variable. To do so, perform a Windows Search for “environment variable” and click “Edit environment variables for your account”.
Under the user variables group, select the Path variable >> click Edit >> append/add the path to where 7zip is installed to.
E.g. C:\Program Files\7-Zip
Below is an example using a Windows 10 machine. The “New” button is selected and the path to the 7zip application folder is provided.
Next, open a command prompt and enter the command “7z”. If the folder location was added correctly to the PATH environment variable, you should see output for usage from the 7z utility.
When you create your job, it is going to execute a batch script that uses 7zip to compress the directories of your choice and encrypt the data set with a password.
Create a file called backup-script.bat, and add the following:
7z a -r Backup -xr!_gsdata_ -p<password>
Replace <path_to_folder> with the full path of the folder you would like to compress (this should be the path to the source set in your GoodSync job).
Replace <password> with the desired password you would like to use for encryption.
The script should look something like this:
The above script compresses all files/folders in the working directory, excludes the hidden _gsdata_ folder (used by the GoodSync application), creates a compressed 7z file called Backup.7z, and encrypts the contents using the password P@$$w0rD.
Next, create a job to back up the Backup.7z file to a remote location of your choosing. If you haven’t created a job before, GoodSync will prompt when opening to give you the ability to create your first job. Otherwise, click the New Job button at the top left corner.
Give the job a name and make sure the job is set to “Backup.”
Set the left directory to the location you would like to compress and back up.
Set the right directory to any remote location of your choice. For more information regarding setting up GoodSync Connect click here.
Open your Job Options by clicking the button at top right.
In the Filters tab, under the Include list, add /Backup.7z. This will ensure the job will only back up the compressed file in the source to the destination, and nothing else.
In the Scripts tab, set the Pre-Analyze Script to the path of the batch script we created.
Automatic scheduling may also be set in the Auto tab of job options if desired. For more information regarding scheduling options, click here.
Great job! You have successfully configured an automated GoodSync backup with compression and encryption using 7z. GoodSync will trigger your script before job run, compress and encrypt all data in your source folder, and backup it up to your specified destination accordingly.