The following use case details the steps for automating a backup job with compression and encryption using 7zip.
1) First, install the 7zip application. 7zip is free and can be downloaded here.
2) 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”.
3) Under the user variables group, select the Path variable >> click Edit >> append/add the path to where 7zip is installed to.
EXAMPLE: C:\Program Files\7-Zip
4) Below is an example using a Windows 10 machine. The “New” button is selected and the path to the 7zip application folder is provided.
5) 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.
6) 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>
7) 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).
8) Replace <password> with the desired password you would like to use for encryption.
The script should look something like this:
9) 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.”
10) Set the left directory to the location you would like to compress and back up.
11) Set the right directory to any remote location of your choice. For more information regarding setting up GoodSync Connect click here.
12) Open your Job Options by clicking the button at top right.
13) 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.
14) In the Scripts tab, set the Pre-Analyze Script to the path of the batch script we created.
15) Automatic scheduling may also be set in the Auto tab of job options if desired. For more information regarding scheduling options, click here.
You have now 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.