burncyclebgn Posted March 8, 2014 Posted March 8, 2014 Hello AutoIT community, I've recently been trying to put together a script that would do a "backup". Essentially, do these steps: Copy folder W:DataCurrent Create new folder in W:DataBACKUP (Name it data + time of folder creation) Paste copied folder into W:DataBACKUP03-08-14-0200 So far this is my code: If WinExists("C:\Windows\system32\cmd.exe") Then WinActivate("C:\Windows\system32\cmd.exe") Send("say Server will be Saving in 3 seconds") Send("{Enter}") Sleep(3000) Send("save-all") Send("{Enter}") Sleep(3000) Send("say Automatic Backup Completed") Send("{Enter}") EndIf FileCopy("W:\MinecraftServer\world", "W:\MinecraftServer\world\BACKUP" + @MON; @DAY; @YEAR) Thank you in advance everyone!
Solution GordonFreeman Posted March 8, 2014 Solution Posted March 8, 2014 (edited) Try $sSource = "W:\MinecraftServer\world\" $sDest = "W:\MinecraftServer\world\BACKUP\" & @MON & "-" & @MDAY & "-" & @YEAR & "_-_" & @HOUR & "-" & @MIN & "-" & @SEC & "\" $iFlag = 9 MsgBox(0,"", "Server will be saving in 3 seconds", 3) $iSucess = FileCopy($sSource, $sDest, $iFlag) If $iSucess = 1 Then MsgBox(0,"", "Automatic Backup Completed. Exiting in 5 seconds", 5) ElseIf $iSucess = 0 Then MsgBox(0,"", "Error", 3) EndIf "save-all" is a server func or you just put to clarify? Edited March 8, 2014 by GordonFreeman Frabjous Installation
burncyclebgn Posted March 8, 2014 Author Posted March 8, 2014 (edited) Try $sSource = "W:\MinecraftServer\world\" $sDest = "W:\MinecraftServer\world\BACKUP\" & @MON & "-" & @MDAY & "-" & @YEAR & "_-_" & @HOUR & "-" & @MIN & "-" & @SEC & "\" $iFlag = 9 MsgBox(0,"", "Server will be saving in 3 seconds", 3) $iSucess = FileCopy($sSource, $sDest, $iFlag) If $iSucess = 1 Then MsgBox(0,"", "Automatic Backup Completed. Exiting in 5 seconds", 5) ElseIf $iSucess = 0 Then MsgBox(0,"", "Error", 3) EndIf "save-all" is a server func or you just put to clarify? Thanks for responding! "save-all" is a server function. So I announce (say) a server save, save the server, then announce (say) it was saved. Wouldn't I have to focus Windows Explorer in order to do the copy pasting of the folder named "world"? edit - good news! It worked perfectly! Except it didn't save in the right area, so I just readjusted that. Thank you so much GordonFreeman! (also, awesome name!) Edited March 8, 2014 by burncyclebgn
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