Windows Backup Scripts Batch

Posted on by admin
Active4 years, 2 months ago

I am using adityasatrio's batch file to backup local MySQL dbs and like to be able to only keep the 30 latest backup files. Using root:root for this example.

Hello I hope someone can help. We use a script which runs a batch file to backup laptops at the company I work at. To get it to work in Windows 7 we just add the user to the backup operators group. We have just started a few people with Windows 10. Set them up in the same way. C: Data'contains batch. Create a Windows Daily Backup Script This tutorial will show you how to use a simple Windows Batch file and the task scheduler to create an automated daily backup. We will use the date variable to backup the files into folders with the first three letters of the day as the folder name. Back up important files with this simple batch file. Run your backup batch file automatically. You'll need to browse for your newly created batch file, because Windows defaults to. Aug 14, 2019  Now that you know how the script works and which switches are necessary, you can launch Notepad, type the command, and save the file as RobocopyBackup.cmd. To make sure that the script and open log. Windows - Incremental backup of data with.BAT (Batch) Loss of data is a big issue associated with formatting your computer. The Windows operating system comes with backup and recovery solutions which can prevent this unexpected problem.

Now I have had a good look at the following questions:

and am now wondering if I can simply add (https://stackoverflow.com/a/14267137/1010918)

(yes I will later change echo to del but first I like to see what will happen)

or (https://stackoverflow.com/a/13368077)

Mysql windows backup batch script

at the end of the batch file, right under

to make this happen?

I have never done this before but have searched for automated local backup apps/php scripts/mysqldump commands/etc for MySQL dbs, even had a go with Workbench only to discover that no scheduling can be set in the community edition (thank you Oracle).

All the other apps either need to have someone open the app and hit 'run now' or want you to pay for setting up a schedule (no thanks).

I think this can be done with the tools at hand on a Windows 7 and later versions machine. Please help me add this functionality to the script, that would be great, thank you.

Windows Backup Scripts Batch 2016

edit1:

He Has To Perform Various Actions Like Pushing, Pulling And Throwing The Enemies Into Dangerous Machines. He Has To Kick, Punch And Make His Opponents Fall From Heights In Order Eliminate Them. Gang beasts free download full version. The Gamer Has To Choose One Character From The Available Characters In Order To Start The Game-play. The Gamer Should Be Very Careful With Various Kinds Of Machines And Their Parts Which Will Kill Him. Gang Beasts PC Game OverviewThe Gamer Has To Fight With Other Players Using The Local Multiplayer Mode In The Gang Beasts PC Game.

When adding the quote commands nothing happens.Also the created backup directory only displays the time but not the year, month and day. Doing further research to find out why. Any ideas?

This comment delete all but X most recent folders talks about deleting the 5 latest folders, though when I use it like this

for /f 'skip=2 delims=' %%a in ('dir %backupDir%%dirName% /o-d /b') do rd /S /Q '%backupDir%%dirName%%%a'

the error is the following.

edit2:Below is the code that with @foxidrive help sets the folder name as I like to have it, but the last bit, trying to only keep the 3 latest folders (for testing purposes only 3) and delete the rest of the folders in the backupDir does not seem to work out.

Thank you for any help.

Community

Create A Batch Script File

lowtechsunlowtechsun
8851 gold badge14 silver badges45 bronze badges

Backup Scripts Cmd

2 Answers

With the help of @foxidrive above I managed to get the date of the folders as I wanted them to be, them being YYYY-MM-DD HH-MIN-SEC.

In these folders are the the gzipped .sql databses stored thanks to adityasatrio's MySQL Backup Batch Script.

With the help of @Magoo from this answer https://stackoverflow.com/a/17521693/1010918 I managed to get all folders (nameDir) deleted while keeping the latest N folders (nameDir) and also not touching any files that might be in the directory (backupDir).

Backup Batch File Example

Here is the complete working script.

Feel free to remove any occurrence of pause and and echo to not see what is going on inside the command prompt.

Additionally add this to Windows Task Scheduler and you have yourself a solid backup solution for a local development environment that makes use of MySQL databases.

Please thank the people that helped me get this done. Without you guys I would have had to use a costly Windows app only to locally save MySQL databases.

(.and for our next trick we are going to email an error log to ourselves if there are errors while backing up the .sql files. but that is another question and story for another day. )

Windows Script To Backup Files

Community
lowtechsunlowtechsun
8851 gold badge14 silver badges45 bronze badges

This is a little more resilient to spaces in folder names, and the date and time routines have been altered
- run it and first check that the 'dirName'= folder is in the right format
- and the line at the end should echo the del commands for keeping the lastest 3 backups.

Test the archiving routine and then
remove the echo before the del keyword if it all looks right to you.

foxidrivefoxidrive
35k7 gold badges38 silver badges64 bronze badges

Windows Backup Scripts Batch 2017

Not the answer you're looking for? Browse other questions tagged mysqlwindowsbatch-filewampserver or ask your own question.