Jump to content
Sign in to follow this  
burncyclebgn

Copy, create new, paste folder

Recommended Posts

burncyclebgn

Hello AutoIT community,

I've recently been trying to put together a script that would do a "backup".

Essentially, do these steps:

  1. Copy folder W:DataCurrent
  2. Create new folder in W:DataBACKUP (Name it data + time of folder creation)
  3. 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!

Share this post


Link to post
Share on other sites
GordonFreeman

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 by GordonFreeman

Share this post


Link to post
Share on other sites
burncyclebgn

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 by burncyclebgn

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×