Computer Hope

Microsoft => Microsoft DOS => Topic started by: TosunPASA on January 09, 2021, 07:00:48 AM

Title: Need backup/rar for mysql at Windows
Post by: TosunPASA on January 09, 2021, 07:00:48 AM
hello friends

i need backup script. i will use with cobian backup shelude. this backup will be execute per 8 hours in day

(sorry... i dont know how i can close/shutdown later re-start Win-MySql... if you know that.. pls add to script)

my source directory = c:\PDKS\DB\

first target/backup path =  e:\PDKS\

second target path = c:\Backup\PDKS\

rar execute path =  C:\Program Files\WinRAR\rar.exe       (sorry)

i need date time stamp before backup --Year ; Month(count  january = 01 - april = 04 - agust = 09 - december = 12) ; Day (count 01,02,03....29-30-31) ; time (00:30:15; 23:12:59)

what i need?
i wanna copy all DB files from (c:\PDKS\DB\*.*)  to  (e:\PDKS\PDKS__%YEAR%_%Month%\PDKS__%year%_%month%_%date%_%hour:min:sec%\*.*)

if all files copyed to target directory... i need compressed file with target directory name.. example  "PDKS__%year%_%month%_%date%__%hour:min:sec%.rar"  (PDKS__2021_01_08__17:07:43.rar)

if db files compressed, must delete that directory from path
mean; i dont need this SUB directory (PDKS__%year%_%month%_%date%__%hour:min:sec%\) at   e:\PDKS\PDKS__%YEAR%_%Month%\

if; first target path is down or protected for write, i need backup file at localpath...  ( this   "e:\"  path is my NAS)

mean; 

backup files must c:\Backup\PDKS\ with same directory name

c:\Backup\PDKS\PDKS__%YEAR%_%Month%\PDKS__%year%_%month%_%date%__%hour:min:sec%\*.*

and compressed file name must be "PDKS__%year%_%month%_%date%__%hour:min:sec%.rar"   (PDKS__2021_01_08__17:07:43.rar)

next step must delete sub directory ; i need just compressed files at (c:\Backup\PDKS\PDKS__%YEAR%_%Month%\)

rar file compress status enough "classic-normal" type; i dont need password for rar file.. this is only backup file

could you help me?


thank you very much

Title: Re: Need backup/rar for mysql at Windows
Post by: Hackoo on January 09, 2021, 09:07:55 AM
Hi  ;)
Note : This format can't be saved as file "PDKS__%year%_%month%_%date%__%hour:min:sec%.rar"
You need to replace : by underscore _ for example  :)

Here is an example using powershell to format your date as you want !
Code: [Select]
@echo off
Title Get Date format as [yyyy_MM_dd__HH_mm_ss] with Powershell in batch file
@for /f %%a in ('powershell -Command "Get-Date -format yyyy_MM_dd__HH_mm_ss"') do set datetime=%%a
echo "PDKS__%datetime%.rar"
pause
Title: Re: Need backup/rar for mysql at Windows
Post by: TosunPASA on January 09, 2021, 09:28:47 AM
hello... i dont know powershell with cobian backup

date format not importand ":" or "_"

i can accept ur offer about this backup

my needs compressed file with date&time format and faster backup.

coudl help me ?


Hi  ;)
Note : This format can't be saved as file "PDKS__%year%_%month%_%date%__%hour:min:sec%.rar"
You need to replace : by underscore _ for example  :)

Here is an example using powershell to format your date as you want !
Code: [Select]
@echo off
Title Get Date format as [yyyy_MM_dd__HH_mm_ss] with Powershell in batch file
@for /f %%a in ('powershell -Command "Get-Date -format yyyy_MM_dd__HH_mm_ss"') do set datetime=%%a
echo "PDKS__%datetime%.rar"
pause