Jump to content

Recommended Posts

Posted

Good day,

As stated in the HelpFile, "2) If the destination already exists and the overwrite flag is specified then the source directory will be moved inside the destination."

I must admit, I was initially having  issues with this command! Now that I do believe that I have a better understanding of this command, I am wondering if the following script would be "acceptable"?
• I am assuming that if the DirMove() command is to be invoked, that the current backup must first be deleted? Correct?

; -----------------------------------------------
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
BackupSetData()
; -----------------------------------------------
Func BackupSetData()
    IfFolderExists()
;~  BackupFolderData()
EndFunc   ;==>BackupSetData
; -----------------------------------------------
Func IfFolderExists()
    Local $sFolder = "F:\Audio\Type_1\SessionTest"
    ; -----------------
    Local $iFileExists = FileExists($sFolder)
    ; -----------------
    If $iFileExists Then
        Local $sMsg = MsgBox(20, "Caution!", "The Destination Folder DOES Exist! Continue?")
        ; -----------------------------------------------
        If $sMsg == 6 Then
            MsgBox($MB_ICONWARNING, "Notice!", "The Existing Data Will First Be Deleted...", 2)
            MsgBox($MB_ICONWARNING, "Backing Up Data...", "The Existing Data Will Now Be Backed-up...", 2)
;~          BackupFolderData()
        ElseIf $sMsg == 7 Then
            MsgBox($MB_ICONINFORMATION, "Exiting...", "The Existing Data Will Not Be Backed-up...", 2)
            Exit
        EndIf
    EndIf
EndFunc   ;==>IfFolderExists
; -----------------------------------------------
Func BackupFolderData()
;~ Dummy
EndFunc   ;==>BackupFolderData
; -----------------------------------------------

As always...any assistance in this matter would be greatly appreciated! Thank you!

Posted

Hello,

A second offering...

; -----------------------------------------------
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
IfBackupFolderExists()
; -----------------------------------------------
Func IfBackupFolderExists()
    Local $sFolder = "F:\Audio\Type_1\SessionTest"
    ; -----------------
    Local $iFileExists = FileExists($sFolder)
    ; -----------------
    If $iFileExists Then
        Local $sMsg = MsgBox(20, "Caution!", "The Destination Folder DOES Exist! Continue?")
        ; -----------------------------------------------
        If $sMsg == 6 Then
            MsgBox($MB_ICONWARNING, "Notice!", "The Existing Data Will 1) Be Deleted..." & @CRLF & @CRLF & "...And 2) The Source Data Will Then Be Backed-up...", 2)
            BackupFolderData()
        ElseIf $sMsg == 7 Then
            MsgBox($MB_ICONINFORMATION, "Notice!", "Exiting...The Existing Data Will Not Be Backed-up...", 2)
            Exit
        EndIf
    EndIf
EndFunc   ;==>IfBackupFolderExists
; -----------------------------------------------
Func BackupFolderData()
    MsgBox($MB_ICONWARNING, "Notice!", "Backing-up The Existing Data...", 3)
EndFunc   ;==>BackupFolderData
; -----------------------------------------------

 

Posted

since it's a backup, why DirMove? and not DirCopy?
... and yes it's better to delete the old files first, and then use DirMove if you want a clean result

I know that I know nothing

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...