Space Engineers Guide

How to automatically backup your dedicated server files from VeryGames [FTP] for Space Engineers

How to automatically backup your dedicated server files from VeryGames [FTP]

Overview

This is kind of specific, but a lot of people utilize VeryGames for their dedicated server. I created a script to backup the game files from the site via their FTP.Hope this helps!BIG THANKS to: eXistenZ [FR]Who helped troubleshoot, and will assist with translating into French. THANK YOU THANK YOU THANK YOU!C’est une sorte de spécifique, mais beaucoup de gens utilisent VeryGames pour leur serveur dédié. J’ai créé un script pour sauvegarder les fichiers du jeu sur le site via leur FTP.Espérons que cela aide!GRAND MERCI à: eXistenZ [FR]Qui a aidé à dépanner, et aidera à traduire en français. MERCI MERCI MERCI!

Requirements / Important Notes

Requirements

FTPUse by Ferro Software
Download here: [link]
Installed to default location: C:Program FilesFERRO SoftwareFtpUse

Notepad++
For editing VBS and BAT files easier than Windows Notepad. Everyone should have this.
Download here: [link]

If you are making these files manually, you’ll also need 7-Zip Command Line Tools
Download here: [link]

  • Unless manually running each time, you’ll need to set it up with Task Scheduler. See bottom of readme.
  • You will need to edit these scripts to your particular needs.
    Each section below outlines each file and what it does. Within each BAT file are also notes on all lines that start with REM. These will guide you.
  • For best results, keep all files together.
  • This script utilizes a command line version of 7-Zip (7za.exe). It needs to be in the same folder as the bat and VBS files.
  • You’ll also need your FTP User/Pass from VeryGames, and to enter it into the script.
  • These scripts assume your U: drive is free and available. If it is not, please change scripts.
    I picked U: as I assumed most people likely wouldn’t have it in use.

You may follow along the rest of this guide, or you can download all the ready-made files here:

https://www.dropbox.com/s/m5kyhm98i9pgfrk/Bean%27s%20SE%20Dedicated%20Server%20Backup%20Scripts%20-%20VeryGames%20FTP.zip?dl=0

Note the ready-made script files still need editing.

French Translation
Exigences

FTPUse par Ferro Software
Télécharger ici : [link]
Installé à l’emplacement par défaut : C:Program FilesFERROSoftwareFtpUse

Notepad++
Pour l’édition des fichiers VBS BAT… plus facile que Bloc-notes Windows . Tout le monde devrait l’avoir …
Télécharger ici : [link]

Si vous faites ces fichiers manuellement , vous aurez également besoin de 7-Zip mode console
Télécharger ici : [link]

  • Sauf en exécutant manuellement à chaque fois , vous aurez besoin de mettre en place avec le Planificateur de tâches. Voir en bas de readme.
  • Vous aurez besoin de modifier ces scripts à vos besoins particuliers.
    Chaque section ci-dessous décrit chaque fichier et ce qu’il fait . Au sein de chaque fichier BAT des notes sont présentes sur toutes les lignes qui commencent par REM afin de vous guider.
  • Pour de meilleurs résultats, conserver tous les fichiers ensemble.
  • Ce script utilise une version en ligne de commande de 7-Zip ( 7za.exe ) . Il doit être dans le même dossier que les fichiers BAT et VBS
  • Vous aurez également besoin de votre utilisateur FTP / Passez de VeryGames , et de les introduire dans le script .
  • Ces scripts supposent que votre U : lecteur est libre et disponible . Si ce n’est pas le cas , s’il vous plaît changer de lettres.
    J’utilise U: car la plupart des gens ne l’utiliserait pas.

Vous pouvez suivre le reste de ce guide, ou vous pouvez télécharger tous les fichiers prêts à l’emploi ici :

https://www.dropbox.com/s/m5kyhm98i9pgfrk/Bean%27s%20SE%20Dedicated%20Server%20Backup%20Scripts%20-%20VeryGames%20FTP.zip?dl=0

Remarque le script “prêt-à-l’emploi” a besoin d’une édition pour inclure vos paramètres

Dedicated Server Automation – Batch File [No Mods Downloaded]

This is the program that is will backup your game server files.
This EXCLUDES the Mods directory. (Due to size/lag)

This program MUST be run as Administrator to run. Else you get Access Denied errors.
This will pop-up in a command window, thus disturbing anything you are doing. See next section to avoid this.

NOTE: This script (for compatibility reasons) needs 7za.exe (7-zip command line) to work.
Please keep it with all the other script files. It needs to be in the same folder as the script (.bat) files.

If you are making this script manually, you’ll need to get it from here:
[link]

Assuming you are not using the ready-made scripts (pointed out in requirements), you can continue here.

Let’s begin.

Open Notepad++ and copy the following code into it:

REM Written by Bean/Delebre. REM Version 1.06 REM 21.10.2014 echo off echo Beginning Automatic Backup of Space Engineers Dedicated Server echo This will take approximately 45 seconds to complete echo Copying 7-Zip Command Line Tool to FTPUse folder, for easier scripting. echo Copying 7-Zip to FTPUse folder copy 7za.exe “C:Program FilesFERRO SoftwareFtpUse” echo Checking for FTP Drive. U: IF NOT EXIST U: GOTO STARTFTPDRIVE :STARTFTPDRIVE echo Starting FTP Drive and assigning it to the U drive letter. cd /D C:Program FilesFERRO SoftwareFtpUse REM NOTE: Change ftpserver.verygames.net to your FTP Server. REM NOTE: Change password to your FTP password REM NOTE: Change usernamehere to your FTP Username. REM NOTE: U: drive is default, as it’s unlikely to conflict. If it does. Change it here, and on line 14, 15, 45 (x2), 49! FTPUSE U: ftpserver.verygames.net password /USER:usernamehere echo Changing Directories @echo off echo Checking for backup folder location. REM NOTE: Change these three locations (Lines 32, 33, 35) to the location you want your backups: e.g. “D:SE Saves” REM NOTE: Make sure you keep the directory location within quote marks. cd /D “D:SE_Remote_Server_Saves” IF NOT EXIST “D:SE_Remote_Server_Saves” GOTO MKDIR ELSE GOTO STARTBACKUP :MKDIR mkdir “D:SE_Remote_Server_Saves” :STARTBACKUP echo copying game files and zipping @echo off echo Confirming FTPUse as working directory cd /D C:Program FilesFERRO SoftwareFtpUse REM NOTE: Change the “D:SE_Remote_Server_Saves” to the location of your saves. As you did on lines 32, 33, 35 above. echo Beginning 7-Zip Archival Backup of Server Files. 7za.exe a -t7z “D:SE_Remote_Server_Saves”SE-Remote-Dedicated-Server-Backup-“%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4%_%time:~0,2%.%time:~3,2%”.7z U: -x!U:Mods echo Tasks Completed. cd /D C:Program FilesFERRO SoftwareFtpUse FTPUSE U: /DELETE REM NOTE: WARNING! THIS PART DELETES FILES! IF YOU DON’T WANT THIS. REMOVE ALL LINES AFTER AND INCLUDING THIS ONE! REM NOTE: Make sure you change “D:SE_Remote_Server_Saves” to your save files location!! REM NOTE: Here you can adjust the cleanup. Default is 5 days. REM NOTE: Simply change the -5 to whatever days. REM NOTE: You cannot use anything less than 1 day. REM NOTE: This ONLY deletes .7z files, in the saves folder. echo Deleting files older than 5 days (Cleanup) forfiles -p “D:SE_Remote_Server_Saves” -s -m *.7z -d -5 -c “cmd /c del @path”

Ok, this is what you’ll need to change/confirm:

Line 11: Ensure that the path to FTPUse is correct.
Line 14 and 15: If you aren’t using the U: drive to mount the FTP server, change here.

Line 24a: First ensure that U: is OK for you (available/not in use).
Line 24b: Change ftpserver.verygames.net to your FTP server location.
Line 24c: Change password to your FTP server password.
Line 24d: Change usernamehere to your FTP server username.
Generally something like: server1234.

Line 45: This is a big one. Piece by piece, this is what it does:

7za.exe a -t7z

This says, use 7zip command line, to make an archive in the 7z format.

“D:SE_Remote_Server_Saves”SE-Remote-Dedicated-Server-Backup-“%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4%_%time:~0,2%.%time:~3,2%”.7z

This overly complicated looking line is actually very straightforward.. It simply says: Make my backup in the folder D:SE_Remote_Server_Saves, with the filename SE-Remote-Dedicated-Server-Backup- and tack on the end of this, the current date, and time, with the file extension 7z.

So your file will be here:
D:SE_Remote_Server_Saves

With a filename like this:
SE-Remote-Dedicated-Server-Backup-21.10.2014_15.00.7z
That’s October 21st, at 3pm for us ‘Muricans.

U:

This simply says WHERE all the files will be coming from.

-x!U:Mods

This says to EXCLUDE the ‘Mods’ folder. You’ll notice this is the exact same code for the mods included script, with this line specific command ommited.

Lines 32, 33, 35, and 45: This is where your files will be zipped/saved. If you want these saved in a different location, you can change this here. It is required that you keep your directory path within the quotation marks.

Line 49: Again, if you aren’t using the U: drive letter as a temporary mount for your FTPUse program, change it to your preferred drive letter here.

Line 58: This line is designed as a cleanup script. By cleanup, I mean that it will DELETE your saves after X number of days. X being defaulted to 5 days.

Let’s take a closer look:

forfiles -p “D:SE_Remote_Server_Saves” -s -m *.7z -d -5 -c “cmd /c del @path”

This says, for file in the path: D:SE_Remote_Server_Saves, -s says recursively look into subdirectories, for the files matching (-m) *.7z (anything dot 7zip). Then anything older than -d (date) -5 (5 days), run command ‘delete’.

So this is a simple thing to adjust. Make ABSOLUTELY CERTAIN that you have the directory correct (where the saves will be). I picked .7z as a format because not a lot of people use it often. So the damage that could occur would be minimal, but still, it’s critical to make sure this path is correct.

Now, you can also change it to a different day criteria. 1 day is the least. It can’t do hours/minutes/seconds. It literally only compares the date.

This is to say too, that if you have it set for 1 day, and you make a save at 11:59pm, after it hits midnight and it’s a new day, this will delete that save. I know it’s silly, but it’s a simple script. So it’s best to have 2+ days of backups.

Now, save the script File > Save As
Name it: [SE]DedicatedServerBackupAutomation.bat
And click the ‘Save as type’ dropdown, and select Batch File (*.bat; *.cmd; *.nt)

So there you have it. It’s a pretty straightforward script! Now, in the next step, we will test it and write a VBS script to enhance it’s abilities.

Dedicated Server Automation – Batch File [No Mods Downloaded] (French Translation)

Sauvergarde automatique de Serveur Dédié – fichier Batch(sans téléchargement des mods)

C’est le programme qui va sauvegarder vos fichiers de serveur de jeux.
Cela exclut le répertoire Mods. (En raison de la taille / lag)

Ce programme DOIT être exécuté en tant qu’administrateur afin de fonctionner. Sinon, vous obtenez des erreurs d’accès refusé.
Ce pop-up dans une fenêtre de commande, perturbant ainsi tout ce que vous faites. Voir la section suivante pour éviter cela.

NOTE : Ce script (pour des raisons de compatibilité) a besoin de 7za.exe (7-zip ligne de commande) pour fonctionner.
S’il vous plaît garder le avec tous les autres fichiers de script. Il doit être dans le même dossier que le script (.bat).

Si vous faites ce script manuellement, vous aurez pourrez l’obtenir ici:
[link]

En supposant que vous n’utilisez pas les scripts prêts à l’emploi (signalées dans les exigences), vous pouvez continuer ici.

Commençons.

Ouvrez notepad++ et copiez le code suivant dedans.

REM Écrit par Bean/Delebre. Traduction eXistenZ REM Version 1.06 REM 21/10/2014 echo off echo Début de sauvegarde automatique de serveur dédié Space Engineers echo durée environ 45 secondes pour terminer echo Copie 7-Zip outil de ligne de commande dans le dossier FTPUse, pour faciliter les scripts. echo Copie 7-Zip dans le dossier FTPUse copy 7za.exe “C:Program FilesFERROSoftwareFtpUse” echo Vérification de FTP Drive. U: IF NOT EXIST U: GOTO STARTFTPDRIVE :STARTFTPDRIVE echo Démarrer FTP Drive et l’affecter à la lettre U. cd /D C:Program FilesFERROSoftwareFtpUse REM NOTE: Changez ftpserver.verygames.net à votre serveur FTP. REM NOTE: Changer password par votre mot de passe FTP REM NOTE: Changer usernamehere à votre Nom d’utilisateur FTP. REM REMARQUE: U: lecteur par défaut, car il est peu probable de conflit. Si c’est le cas. Changez-le ici, et sur ​​la ligne 14, 15, 45 (x2), 49! FTPUSE U: ftpserver.verygames.net password /USER:usernamehere echo Changement de répertoire @echo off echo Vérification du dossier de sauvegarde cible. REM NOTE: Changer ces trois endroits (lignes 32, 33, 35) à l’endroit où vous voulez vos sauvegardes: par exemple, “D:SE_Remote_Server_Saves” REM REMARQUE: Assurez-vous de garder l’emplacement du répertoire entre guillemets. cd /D “D:SE_Remote_Server_Saves” IF NOT EXIST “D:SE_Remote_Server_Saves” GOTO MKDIR ELSE GOTO STARTBACKUP :MKDIR mkdir “D:SE_Remote_Server_Saves” :STARTBACKUP echo copier et compresser les fichiers du jeu @echo off echo Confirme FTPUse comme répertoire de travail cd /D C:ProgramFilesFERROSoftwareFtpUse REM NOTE: Changer le “D:SE_Remote_Server_Saves” à l’emplacement de vos sauvegardes. Comme vous l’avez fait sur ​​les lignes 32, 33, 35 ci-dessus. echo début archive de sauvegarde des fichiers du serveur. 7za.exe a -t7z “D:SE_Remote_Server_Saves”SE-Remote-Dedicated-Server-Backup-“%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4%_%time:~0,2%.%time:~3,2%”.7z U: -x!U:Mods echo Taches accomplies cd /D C:ProgramFilesFERROSoftwareFtpUse FTPUSE U:/ DELETE REM NOTE: ATTENTION! CETTE PARTIE supprime les fichiers! SI VOUS NE VOULEZ PAS : Supprimez toutes les lignes APRES ET Y COMPRIS CELLES-CI! REM REMARQUE: Assurez-vous que vous changez “D:SE_Remote_Server_Saves” à votre emplacement de sauvegarde des fichiers !! REM NOTE: Ici, vous pouvez régler le nettoyage. Défaut est de 5 jours. REM NOTE: Il suffit de changer le -5 à quelque soit jours. REM REMARQUE: Le minimun est 1 jour. REM REMARQUE: cela supprime uniquement .7z fichiers, dans le dossier de sauvegarde D:SE_Remote_Server_Saves. echo Suppression des fichiers de plus de 5 jours (nettoyage) forfiles -p “D:SE_Remote_Server_Saves” -s -m *.7z -d -5 -c “cmd /c del @path”

Ok, c’est ce que vous aurez besoin de changer / confirmer:

Ligne 11 : Vérifiez que le chemin à FTPUse est correct.
Ligne 14 et 15 : Si vous n’utilisez pas le U: pour monter le serveur FTP, changer ici.

ligne 24a: d’abord veiller à ce que U: est OK pour vous (disponible / pas en cours d’utilisation).
Ligne 24b : Changer ftpserver.verygames.net à l’emplacement de votre serveur FTP.
ligne 24c : Change password pour votre mot de passe du serveur FTP.
Ligne 24d : Change usernamehere à votre nom d’utilisateur du serveur FTP.
Généralement quelque chose comme: server1234.

Ligne 45 : C’est du lourd,étape par étape, ce qu’il fait:

7za.exe un -t7z

Cela dit, utiliser la ligne de commande 7zip, de faire une archive au format 7z.

“D:SE_Remote_Server_Saves”SE-Remote-Dedicated-Server-Backup-“%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4%_%time:~0,2%.%time:~3,2%”.7z

Cette ligne qui semble trop compliqué est en fait très simple .. elle dit simplement: Faire ma sauvegarde dans le dossier D:SE_Remote_Server_Saves, avec le nom du fichier SE-Remote-Dedicated-Server-Backup- et à la fin de cela, la date du jour , l’heure, avec le 7z extension de fichier.

Donc, votre fichier sera ici:
D:SE_Remote_Server_Saves

Avec un nom de fichier comme ceci:
SE-Remote-Dedicated-Server-Backup-21.10.2014_15.00.7z
Soit le 21 Octobre à 15 heures

U:

dit simplement d’où tous les fichiers viennent.

-x U:Mods

dit d’exclure le dossier «Mods». Vous remarquerez que c’est le même même code pour les mods inclus script, avec cette commande spécifique de la ligne omise.

Les lignes 32, 33, 35, et 45 : C’est là que vos fichiers seront compressés/sauvés. Si vous souhaitez enregistré dans un emplacement différent, vous pouvez changer cette sélection ici. Il est nécessaire

que vous gardiez votre chemin du répertoire dans les guillemets.

Ligne 49: Encore une fois, si vous n’utilisez pas U: pour monter votre programme FTPUse, changer à votre lettre préférée d’entraînement ici.

Ligne 58: Cette ligne est conçu comme un script de nettoyage. Par nettoyage, je veux dire que cela va effacer votre sauvegarde après X nombre de jours. X étant par défaut à 5 jours.

Regardons de plus près:

forfiles -p “D:SE_Remote_Server_Saves” -s -m *.7z -d -5 c “cmd /c delpath”

Cela dit, pour le fichier dans le chemin: D:SE_Remote_Server_Saves, -s dit de manière récursive regarder dans les sous-répertoires, les fichiers correspondant (-m) *.7z (tout .7zip). Puis rien de plus que -d

(date) -5 (5 jours), lancez la commande ‘delete’.

Donc, c’est une chose simple à régler. Assurez-vous ABSOLUMENT que vous avez le bon répertoire (où les sauvegardes seront). J’ai pris .7z comme un format parce que pas beaucoup de gens

l’utilisent souvent. Ainsi, le dommage qui pourrait survenir serait minime, mais encore, il est essentiel de s’assurer que ce chemin est correct.

Maintenant, vous pouvez également changer de critères différents de jour. Un jour étant le minimum. Il ne peut pas faire d’heures / minutes / secondes. Il ne compare que la date.

C’est-à-dire aussi, que si vous avez défini pour un jour, et que vous faites une sauvegarde à 23h59, après avoir touché minuit et c’est un nouveau jour, ce sera le supprimer sauver. Je sais que c’est stupide,

mais c’est un simple script. Il est donc préférable d’avoir 2 jours et + de sauvegardes.

Maintenant, enregistrez le fichier script> Enregistrer sous
Nommez-le: [SE] DedicatedServerBackupAutomation.bat
Et cliquez sur le “Save as type” menu déroulant, puis sélectionnez fichier batch (* bat; * .cmd; * .nt)

Donc là vous l’avez. C’est un script très simple! Maintenant, dans l’étape suivante, nous allons le tester et écrire un script VBS afin d’améliorer ses capacités .

Testing the script and creating the hidden VBS script.

Let’s test our script we just created. Now, you COULD right-click the file and choose ‘Run as Administrator’. However, if it doesn’t work.. you’ll not see any errors because the console window will close after you run it.

So first, you need to run a command window as administrator. If you don’t know how to do this, go here:
Windows 7/Vista [www.howtogeek.com]

Windows 8 [www.howtogeek.com]

Now navigate to where you have the BAT file you made. Run it!

It should create a file in the folder you set, and be done after a minute or so.

If you have problems, read the error messages carefully, look over your code for mistakes, and re-read the previous section. You’ll most assuredly find your answer there.

Now that you have it working, we need to make it run silently. Otherwise whenever it runs, that console window will disrupt anything you are doing. Luckily, this is very easy.

In Notepad++ paste the following code:

Set WshShell = CreateObject(“WScript.Shell”) WshShell.Run chr(34) & “D:SE_Remote_Server_Saves[SE]DedicatedServerBackupAutomation.bat” & Chr(34), 0 Set WshShell = Nothing

Simple right? All we need to do, is make sure that the path to the [SE]DedicatedServerBackupAutomation.bat is set properly. That’s it! Simply make sure that it points to where you will keep your [SE]DedicatedServerBackupAutomation.bat file.

Now, save the file as: [SE]DedicatedServerBackupAutomation-hidden.vbs
Making sure that the drop-down ‘Save as type’ selected is ‘Visual Basic (*.vb; *.vbs)

Done!

Now, let’s test it! Right-click on this, and choose ‘Run as Administrator’
If all is well, you won’t see anything happen, but you will see a new file created that made a backup at ~this time you ran it.

That’s fantastic! Now let’s automate this.

French Translation

Testons le script que nous venons de créer. Maintenant, vous pouvez faire clic droit sur le fichier et choisir “Exécuter en tant qu’administrateur». Cependant, si cela ne fonctionne pas .. vous ne verrez pas d’erreurs parce que la fenêtre de la console se fermera après son exécution.

Alors d’abord, vous devez exécuter une fenêtre de commande en tant qu’administrateur. Si vous ne savez pas comment faire, cliquez ici:

Windows 7/Vista [www.howtogeek.com]

Windows 8 [www.howtogeek.com]

Maintenant naviguer à l’endroit où vous avez le fichier BAT que vous avez fait. Lancez-le!

Il devrait créer un fichier dans le dossier que vous définissez, et apparaitre après une ou deux minutes.

Si vous avez des problèmes, veuillez lire attentivement les messages d’erreur, regarder votre code d’erreurs, et relire la section précédente. Vous trouverez très certainement votre réponse là-bas.

Maintenant que vous avez ce travail, nous avons besoin de le faire fonctionner en arrière plan. Sinon chaque fois qu’il se lance, la fenêtre de la console va perturber tout ce que vous faites. Heureusement, cela est très facile.

Dans Notepad ++ collez le code suivant:

Set WshShell = CreateObject(“WScript.Shell”) WshShell.Run chr(34) & “D:SE_Remote_Server_Saves[SE]DedicatedServerBackupAutomation.bat” & Chr(34), 0 Set WshShell = Nothing

Simple non? tout ce dont on a besoin, c’est d’être sur que le chemin de [SE]DedicatedServerBackupAutomation.bat est configurer correctement. C’est tout! Il suffit de s’assurer qu’il cible là où vous pourrez garder votre fichier [SE]DedicatedServerBackupAutomation.bat

Maintenant sauvegarder le fichier en tant que [SE]DedicatedServerBackupAutomation-hidden.vbs
choisissez bien ‘savegarder en tant que’ au format ‘Visual Basic (*.vb; *.vbs)

Maintenant, nous allons le tester! Faites un clic droit sur ​​ce .vbs, et choisir “Exécuter en tant qu’administrateur”
Si tout va bien, vous ne verrez rien arriver, mais vous verrez un nouveau fichier créé qui a fait une sauvegarde au moment où vous l’avez exécuté.

C’est fantastique! Maintenant, nous allons automatiser cela.

Using Task Scheduler to run your scripts on a schedule

Because I don’t want to type this all out and make a bunch of screenshots.. enjoy this YouTube video:

Link here: [link]

It said ‘error’ for me when I ran this, but if you go to the link it works. So Steam, wtf?

PS – Sorry for the soda pssst. I was thirsty. 😀

Dedicated Server Automation – Batch File [With Mods Downloaded]

This is the program that is will backup your game server files.
This EXCLUDES the Mods directory. (Due to size/lag)

This program MUST be run as Administrator to run. Else you get Access Denied errors.
This will pop-up in a command window, thus disturbing anything you are doing. See next section to avoid this.

NOTE: This script (for compatibility reasons) needs 7za.exe (7-zip command line) to work.
Please keep it with all the other script files. It needs to be in the same folder as the script (.bat) files.

If you are making this script manually, you’ll need to get it from here:
[link]

Assuming you are not using the ready-made scripts (pointed out in requirements), you can continue here.

Let’s begin.

Open Notepad++ and copy the following code into it:

REM Written by Bean/Delebre. REM Version 1.06 REM 21.10.2014 echo off echo Beginning Automatic Backup of Space Engineers Dedicated Server echo This will take approximately 45 seconds to complete echo Copying 7-Zip Command Line Tool to FTPUse folder, for easier scripting. echo Copying 7-Zip to FTPUse folder copy 7za.exe “C:Program FilesFERRO SoftwareFtpUse” echo Checking for FTP Drive. U: IF NOT EXIST U: GOTO STARTFTPDRIVE :STARTFTPDRIVE echo Starting FTP Drive and assigning it to the U drive letter. cd /D C:Program FilesFERRO SoftwareFtpUse REM NOTE: Change ftpserver.verygames.net to your FTP Server. REM NOTE: Change password to your FTP password REM NOTE: Change usernamehere to your FTP Username. REM NOTE: U: drive is default, as it’s unlikely to conflict. If it does. Change it here, and on line 14, 15, 45 (x2), 49! FTPUSE U: ftpserver.verygames.net password /USER:usernamehere echo Changing Directories @echo off echo Checking for backup folder location. REM NOTE: Change these three locations (Lines 32, 33, 35) to the location you want your backups: e.g. “D:SE Saves” REM NOTE: Make sure you keep the directory location within quote marks. cd /D “D:SE_Remote_Server_Saves” IF NOT EXIST “D:SE_Remote_Server_Saves” GOTO MKDIR ELSE GOTO STARTBACKUP :MKDIR mkdir “D:SE_Remote_Server_Saves” :STARTBACKUP echo copying game files and zipping @echo off echo Confirming FTPUse as working directory cd /D C:Program FilesFERRO SoftwareFtpUse REM NOTE: Change the “D:SE_Remote_Server_Saves” to the location of your saves. As you did on lines 32, 33, 35 above. echo Beginning 7-Zip Archival Backup of Server Files. 7za.exe a -t7z “D:SE_Remote_Server_Saves”SE-Remote-Dedicated-Server-Backup-“%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4%_%time:~0,2%.%time:~3,2%”.7z U: -x!U:Mods echo Tasks Completed. cd /D C:Program FilesFERRO SoftwareFtpUse FTPUSE U: /DELETE REM NOTE: WARNING! THIS PART DELETES FILES! IF YOU DON’T WANT THIS. REMOVE ALL LINES AFTER AND INCLUDING THIS ONE! REM NOTE: Make sure you change “D:SE_Remote_Server_Saves” to your save files location!! REM NOTE: Here you can adjust the cleanup. Default is 5 days. REM NOTE: Simply change the -5 to whatever days. REM NOTE: You cannot use anything less than 1 day. REM NOTE: This ONLY deletes .7z files, in the saves folder. echo Deleting files older than 5 days (Cleanup) forfiles -p “D:SE_Remote_Server_Saves” -s -m *.7z -d -5 -c “cmd /c del @path”

Ok, this is what you’ll need to change/confirm:

Line 11: Ensure that the path to FTPUse is correct.
Line 14 and 15: If you aren’t using the U: drive to mount the FTP server, change here.

Line 24a: First ensure that U: is OK for you (available/not in use).
Line 24b: Change ftpserver.verygames.net to your FTP server location.
Line 24c: Change password to your FTP server password.
Line 24d: Change usernamehere to your FTP server username.
Generally something like: server1234.

Line 45: This is a big one. Piece by piece, this is what it does:

7za.exe a -t7z

This says, use 7zip command line, to make an archive in the 7z format.

“D:SE_Remote_Server_Saves”SE-Remote-Dedicated-Server-Backup-“%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4%_%time:~0,2%.%time:~3,2%”.7z

This overly complicated looking line is actually very straightforward.. It simply says: Make my backup in the folder D:SE_Remote_Server_Saves, with the filename SE-Remote-Dedicated-Server-Backup- and tack on the end of this, the current date, and time, with the file extension 7z.

So your file will be here:
D:SE_Remote_Server_Saves

With a filename like this:
SE-Remote-Dedicated-Server-Backup-21.10.2014_15.00.7z
That’s October 21st, at 3pm for us ‘Muricans.

U:

This simply says WHERE all the files will be coming from. So this will grab everything in your FTP server.

Lines 32, 33, 35, and 45: This is where your files will be zipped/saved. If you want these saved in a different location, you can change this here. It is required that you keep your directory path within the quotation marks.

Line 49: Again, if you aren’t using the U: drive letter as a temporary mount for your FTPUse program, change it to your preferred drive letter here.

Line 58: This line is designed as a cleanup script. By cleanup, I mean that it will DELETE your saves after X number of days. X being defaulted to 5 days.

Let’s take a closer look:

forfiles -p “D:SE_Remote_Server_Saves” -s -m *.7z -d -5 -c “cmd /c del @path”

This says, for file in the path: D:SE_Remote_Server_Saves, -s says recursively look into subdirectories, for the files matching (-m) *.7z (anything dot 7zip). Then anything older than -d (date) -5 (5 days), run command ‘delete’.

So this is a simple thing to adjust. Make ABSOLUTELY CERTAIN that you have the directory correct (where the saves will be). I picked .7z as a format because not a lot of people use it often. So the damage that could occur would be minimal, but still, it’s critical to make sure this path is correct.

Now, you can also change it to a different day criteria. 1 day is the least. It can’t do hours/minutes/seconds. It literally only compares the date.

This is to say too, that if you have it set for 1 day, and you make a save at 11:59pm, after it hits midnight and it’s a new day, this will delete that save. I know it’s silly, but it’s a simple script. So it’s best to have 2+ days of backups.

Now, save the script File > Save As
Name it: [SE]DedicatedServerBackupAutomationPlusMods.bat
And click the ‘Save as type’ dropdown, and select Batch File (*.bat; *.cmd; *.nt)

So there you have it. It’s a pretty straightforward script! Now, in the next step, we will test it and write a VBS script to enhance it’s abilities.

Testing the script and creating the hidden VBS script.

Let’s test our script we just created. Now, you COULD right-click the file and choose ‘Run as Administrator’. However, if it doesn’t work.. you’ll not see any errors because the console window will close after you run it.

So first, you need to run a command window as administrator. If you don’t know how to do this, go here:
Windows 7/Vista [www.howtogeek.com]

Windows 8 [www.howtogeek.com]

Now navigate to where you have the BAT file you made. Run it!

It should create a file in the folder you set, and be done after a minute or so.

If you have problems, read the error messages carefully, look over your code for mistakes, and re-read the previous section. You’ll most assuredly find your answer there.

Now that you have it working, we need to make it run silently. Otherwise whenever it runs, that console window will disrupt anything you are doing. Luckily, this is very easy.

In Notepad++ paste the following code:

Set WshShell = CreateObject(“WScript.Shell”) WshShell.Run chr(34) & “D:SE_Remote_Server_Saves[SE]DedicatedServerBackupAutomationPlusMods.bat” & Chr(34), 0 Set WshShell = Nothing

Simple right? All we need to do, is make sure that the path to the [SE]DedicatedServerBackupAutomationPlusMods.bat is set properly. That’s it! Simply make sure that it points to where you will keep your [SE]DedicatedServerBackupAutomationPlusMods.bat file.

Now, save the file as: [SE]DedicatedServerBackupAutomation-hiddenPlusMods.vbs
Making sure that the drop-down ‘Save as type’ selected is ‘Visual Basic (*.vb; *.vbs)

Done!

Now, let’s test it! Right-click on this, and choose ‘Run as Administrator’
If all is well, you won’t see anything happen, but you will see a new file created that made a backup at ~this time you ran it.

That’s fantastic! Now let’s automate this.

Please go back to the section ‘Using Task Scheduler to run your scripts on a schedule’

SteamSolo.com