Auto-Backup

  • Hab mir mal ein kleines Tool Programmiert mit dem automatisch alle meine Autoit Programme auf einen anderen Rechner (bei mir server) kopiert werden.

    Ist Sinnvoll wenn mal die HDD den Geist aufgibt damit mann sein zeug noch hat. Vielleicht braucht es ja jemand :)

    Es wird untersucht ob die Datei / Ordner Vorhanden ist und ob die Größe ungleich ist.Hab bei mir auf 60 sekunden gestellt so das wenn ich was neues anlege eigentlich gleich gesichert wird.Kann man natürlich seinen wünschen entsprechend anpassen.

    Mfg
    Tam0r

    P.s Das einzige was nicht sein darf ist, das die ordner punkte enthalten und das es keine dateien geben darf die keine endung haben.(also das kein punkt vorkommt)

    Falscher Ordner = ProjektxV1.3.4
    Falsche Datei = Test


    [autoit]


    $Ausgangspfad = "e:\Auto it\source\"
    $Zielpfad = "\\192.168.6.4\My\"

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    AdlibEnable ( "_synch", 5000)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    While 2
    sleep (10)
    WEnd

    [/autoit][autoit][/autoit][autoit]

    Func _synch()
    AdlibDisable()
    $search = FileFindFirstFile($Ausgangspfad&"*.*")

    [/autoit][autoit][/autoit][autoit]

    While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop

    if StringInStr($file, ".") > 0 Then
    if Not FileExists ( $Zielpfad&$file) Then
    TrayTip("Synch","File Not Found"&@CRLF&$file, 10, 4)
    $File_ergebnis = Filecopy ( $Ausgangspfad&$file, $Zielpfad&$file)
    If $File_ergebnis = 1 Then
    TrayTip("Synch File Copy","OK"&@CRLF&$file, 10, 4)
    Else
    TrayTip("Synch File Copy","Error"&@CRLF&$file, 10, 2)
    EndIf
    Else
    if FileGetSize ($Ausgangspfad&$file) <> FileGetSize ($Zielpfad&$file) Then
    TrayTip("Synch","File Size Change"&@CRLF&$file, 10, 4)
    $File_ergebnis = Filecopy ( $Ausgangspfad&$file, $Zielpfad&$file,1)
    If $File_ergebnis = 1 Then
    TrayTip("Synch File Copy","OK"&@CRLF&$file, 10, 4)
    Else
    TrayTip("Synch File Copy","Error"&@CRLF&$file, 10, 2)
    EndIf
    Else
    EndIf
    EndIf
    Else
    if Not FileExists ( $Zielpfad&$file) Then
    TrayTip("Synch","Dir Not Found"&@CRLF&$file, 10, 4)
    $Dir_ergebnis = DirCopy ( $Ausgangspfad&$file, $Zielpfad&$file,1)
    If $Dir_ergebnis = 1 Then
    TrayTip("Synch Dir Copy","OK"&@CRLF&$file, 10, 4)
    Else
    TrayTip("Synch Dir Copy","Error"&@CRLF&$file, 10, 2)
    EndIf

    [/autoit][autoit][/autoit][autoit]

    Else
    if DirGetSize ($Ausgangspfad&$file) <> DirGetSize ($Zielpfad&$file) Then
    TrayTip("Synch","Dir Size Change"&@CRLF&$file, 10, 4)
    $Dir_ergebnis = DirCopy ( $Ausgangspfad&$file, $Zielpfad&$file,1)
    If $Dir_ergebnis = 1 Then
    TrayTip("Synch Dir Copy","OK"&@CRLF&$file, 10, 4)
    Else
    TrayTip("Synch Dir Copy","Error"&@CRLF&$file, 10, 2)
    EndIf

    [/autoit][autoit][/autoit][autoit]

    Else
    EndIf
    EndIf

    EndIf
    WEnd
    FileClose($search)
    AdlibEnable ( "_synch", 60000)
    EndFunc

    [/autoit]

    2 Mal editiert, zuletzt von Tam0r (8. Oktober 2006 um 02:10)