_Zano Posted March 28, 2023 Share Posted March 28, 2023 I wanted to make a simple tutorial for those that don't know how to make an automated backup for their server. Backups are very important, but I find myself forgetting to do them frequently, so here is the solution! Â First off is the batch file, I will post mine and explain a little about it. xcopy /i /e /f C:\Users\*\*\Server \\*\*\Backup\"%date%" The *'s are put in place of my directory, you should replace "C:\Users\*\*\Server" with the directory to your server files, and "\\*\*\Backup\" with where you want the backups to be saved. Â The reason my second file path doesn't have a drive letter and only two slashes is because it is a network drive, which is ideal for backups. It would work if you saved your backups to the same machine that the server is running on. but it wouldn't be much help if that computer broke somehow, external backups are always better. Â Now, there isn't much else to explain because its very simple. Xcopy is a windows command, more info about it can be found here. The %date% section grabs the current date from the computer and makes it the files name, in conjunction with the /i parameter It will create a new folder named the current time whenever the script is run. Â Once you have a text file with the script typed it, and the correct file paths, save it with the extension .bat instead of .txt, then run it and see if there are any errors. One common one may be the file name. Another common issue is the fact that the xcopy command doesn't like when there are spaces in filenames, if you have any files in your path that include spaces, replace them with something else like an underscore. Spoiler By default (for North America at least) the date format contains a slash. You cannot have a slash in a file name, so to change this navigate to the date and time settings on your computer, the easiest way to do this is to click the time in the lower right corner, and click date and time settings. On windows 10 you should see related settings on the right side, click the one called "Date, time & regional formatting". Click change data formats on the bottom, and change the short date to the one that has hyphens instead of slashes. Â After you verified that the script works as intended, you can set up the task scheduler to actually make it run automatically. Â To do this open task scheduler by pressing the windows key and typing in "task scheduler". Once open, on the right side of the window you will see the "Actions" tab, in there select the option to create a basic task. Give the task a name, select how often you want the back up to occur, select the time and day you want it to happen, and finally choose the "start a program" option. After clicking next, select browse to find your batch file and select it. Â After that It is complete and should run the script at your selected date and time! I have mine backing up every week, It is fine to run a backup while the server is running so no need to shut it off first. Â If you have any problems post a comment and I'll try to help, but google knows all, and this is a relatively simple script, it shouldn't be hard to fix any errors after a couple minutes of searching. Smallio_Pro, Artheios, PyroTech03 and 1 other 4 Link to comment Share on other sites More sharing options...
Smallio_Pro Posted March 28, 2023 Share Posted March 28, 2023 Takes me back to my sys admin days. Nice tutorial _Zano 1 Link to comment Share on other sites More sharing options...
Quineya Posted December 6 Share Posted December 6 Â I always forget about scheduled backups too. Â Thanks for sharing Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now