1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
|
Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
Dim pathSupport As String
Dim pathSource As String
Dim pathSave As String
Dim saveType As String
Dim saveName As String
Dim lastSave As String
pathSupport = "C:\sauvegarde Wanadoo\support.txt"
pathSource = "C:\sauvegarde Wanadoo\sources.txt"
pathSave = "C:\sauvegarde Wanadoo\lastSave.txt"
If Not File.Exists(pathSave) Then
saveName = "Totale1.bkf"
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If File.Exists(pathSave) Then
lastSave = File.ReadAllText(pathSave)
If lastSave = "Totale1.bkf" Then
saveName = "inc1a.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc1a.bkf" Then
saveName = "inc1b.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc1b.bkf" Then
saveName = "inc1c.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc1c.bkf" Then
saveName = "inc1d.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc1d.bkf" Then
saveName = "inc1e.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc1e.bkf" Then
saveName = "inc1f.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc1f.bkf" Then
saveName = "Totale2.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "Totale2.bkf" Then
saveName = "inc2a.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc2a.bkf" Then
saveName = "inc2b.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc2b.bkf" Then
saveName = "inc2c.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc2c.bkf" Then
saveName = "inc2d.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc2d.bkf" Then
saveName = "inc2e.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc2e.bkf" Then
saveName = "inc2f.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
If lastSave = "inc2f.bkf" Then
saveName = "Total1.bkf"
File.Delete(pathSave)
File.Create(pathSave)
File.WriteAllText(pathSave, saveName)
End If
End If
If saveName = "Totale1.bkf" Or "Totale2.bkf" Then
saveType = "normale"
End If
If Not saveName = "Totale1.bkf" Or "Totale2.bkf" Then
saveType = "incrémentielle"
End If
Dim support As String
Dim sources As String = ""
support = File.ReadAllText(pathSupport) & "\" & saveName
sources = File.ReadAllText(pathSource)
Dim backup As New System.Diagnostics.Process
' Nom de l'executable à lancer
backup.StartInfo.FileName = "ntbackup.exe"
' Arguments à passer à l'exécutable à lancer
backup.StartInfo.Arguments = "backup " & sources & " /f " & support & " /m " & saveType
' Démarrage du processus
backup.Start()
End Sub |
Partager