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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
|
<html>
<body>
<span style="color:#00000;font-family: Verdana;font-size: 13pt">Bienvenue dans l'utilitaire de sauvegarde de vos données personnelles.</span>
<br><br>
Sélectionnez le dossier à sauver :
<br>
<br>
<span style="color:red;font-family: Berlin Sans FB Demi">
/!\ Avant de commencer, Veuillez fermer toutes vos applications en cours /!\</span>
<br>
<br>
<input type="checkbox" ID="Doc" name="Doc"> : Sauvegarde de Mes Documents (Tous les fichiers)
<br>
<input type="checkbox" ID="Bur" name="Bur"> : Sauvegarde du Bureau (Tous les fichiers)
<br>
<input type="checkbox" ID="PST" name="PST"> : Sauvegarde UNIQUEMENT le/les PST
<script type="text/javascript">
function fermer()
{
self.close();
}
</script>
<SCRIPT LANGUAGE="VBScript">
ResizeTo 700,400
'Fenêtre pour choisir repertoire cible de sauvegarde
BIF_returnonlyfsdirs = &H0001
BIF_dontgobelowdomain = &H0002
BIF_editbox = &H0010
BIF_validate = &H0020
BIF_browseforcomputer = &H1000
Dim shell, item
Set shell = CreateObject("Shell.Application")
flag=BIF_returnonlyfsdirs
titre="Sélectionner la destination de la sauvegarde"
Set Item = shell.BrowseForFolder(0,titre,flag, dirinit)
If isvalue(Item) Then
objPath=Item.Title
' Test si on a sélectionné la racine d'une partition
If InStr(1,objPath,":")=0 Then
objPath=Item.ParentFolder.ParseName(Item.Title).Path
End If
arobrescence
else
msgbox "Annulation de la sauvegarde"
fermer()
End If
' Vérifie si un répertoire a été sélectionné
Function IsValue(obj)
Dim tmp
On Error Resume Next
tmp = " " & obj
If Err <> 0 Then IsValue = False Else IsValue = True
On Error GoTo 0
End Function
'==================================================================================================================
' Création de l'arobrescence Sauvegarde_donnée=> Mes Documents / Bureau / PST dans le repertoire cible sélectionné
'==================================================================================================================
Racine = objPath & "\" & "Sauvegarde_données"
sub arobrescence
Dim oFSO
Racine = objPath & "\" & "Sauvegarde_données"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Rep_existe_racine = oFSO.FolderExists(Racine)
Rep_existe_MesDoc = oFSO.FolderExists(Racine & "\" & "Mes documents")
Rep_existe_Bureau = oFSO.FolderExists(Racine & "\" & "Bureau")
Rep_existe_PST = oFSO.FolderExists(Racine & "\" & "Mes PST")
if Rep_existe_racine = true then
if Rep_existe_MesDoc = true then
Else
MesDocuments=oFSO.CreateFolder (Racine & "\" & "Mes documents")
End If
if Rep_existe_Bureau = true then
Else
Bureau=oFSO.CreateFolder (Racine & "\" & "Bureau")
End If
if Rep_existe_PST = true then
Else
Pst_Folder=oFSO.CreateFolder (Racine & "\" & "Mes PST")
End If
else
Racine=oFSO.CreateFolder (objPath & "\" & "Sauvegarde_données")
MesDocuments=oFSO.CreateFolder (Racine & "\" & "Mes documents")
Bureau=oFSO.CreateFolder (Racine & "\" & "Bureau")
Pst_Folder=oFSO.CreateFolder (Racine & "\" & "Mes PST")
End If
End sub
'==================================================================================================================
'Fonction pour backuper le Bureau
'==================================================================================================================
sub backup_Bur
Set WshShell = CreateObject("WScript.Shell")
'MonBur est le repertoire mes documents de l'utilisateur en cours
MonBur = WShShell.SpecialFolders("Desktop")
Dim objFSO, objWshell, oIE, oIEDoc, objSourceFolder, objDestinationFolder
set objWshell = CreateObject("Wscript.Shell")
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Navigate "about:blank"
do while oIE.busy : wscript.sleep 10 : loop
Set oIEDoc = oIE.Document
oIE.AddressBar = False
oIE.StatusBar = False
oIE.ToolBar = False
oIE.Document.Body.Scroll = "no"
oIE.document.title = "Utilitaire backup"
oIE.height=100
oIE.width=200
oIE.Resizable = False
oIE.Visible = True
sMsg= "<center>Sauvegarde en cours<br>Please wait...<br><br>"
oIEDoc.Body.Innerhtml= sMsg
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
objSourceFolder = MonBur
objDestinationFolder = Bureau
Set oFSO = CreateObject("Scripting.FileSystemObject")
Bureau = Racine & "\" & "Bureau"
set fd=oFSO.getfolder(objSourceFolder)
Fd.Copy Bureau,true
Set oIEDoc = Nothing
oIE.Quit
Set oIE = Nothing
' Set objFSO = Nothing
' Set objWshell = Nothing
' Set WshShell = Nothing
End sub
'==================================================================================================================
'Fonction pour backuper mes documents
'==================================================================================================================
sub backup_Doc
Set WshShell = CreateObject("WScript.Shell")
'MesDoc est le repertoire mes documents de l'utilisateur en cours
Mesdoc = WShShell.SpecialFolders("MyDocuments")
Dim objFSO, objWshell, oIE, oIEDoc, objSourceFolder, objDestinationFolder
set objWshell = CreateObject("Wscript.Shell")
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Navigate "about:blank"
do while oIE.busy : wscript.sleep 10 : loop
Set oIEDoc = oIE.Document
oIE.AddressBar = False
oIE.StatusBar = False
oIE.ToolBar = False
oIE.Document.Body.Scroll = "no"
oIE.document.title = "Utilitaire backup"
oIE.height=100
oIE.width=200
oIE.Resizable = False
oIE.Visible = True
sMsg= "<center>Sauvegarde en cours<br>Please wait...<br><br>"
oIEDoc.Body.Innerhtml= sMsg
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
objSourceFolder = Mesdoc
objDestinationFolder = MesDocuments
Set oFSO = CreateObject("Scripting.FileSystemObject")
MesDocuments = Racine & "\" & "Mes documents"
set fd=oFSO.getfolder(objSourceFolder)
Fd.Copy MesDocuments,true
Set oIEDoc = Nothing
oIE.Quit
Set oIE = Nothing
' Set objFSO = Nothing
' Set objWshell = Nothing
' Set WshShell = Nothing
End sub
'==================================================================================================================
' Fonction pour backuper uniquement les PST présent dans le profil de l'utilisateur en cours
'==================================================================================================================
Dim objFS
Dim strFolder
Dim objFolder
Set objFS = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
Pst_Folder = Racine & "\" & "Mes PST"
strFolder=CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%\")
Set objFolder = objFS.GetFolder(strFolder)
Sub backup_PST(objDIR)
Dim strFile
For Each eFolder in objDIR.SubFolders
backup_PST eFolder
Next
For Each strFile In objDIR.Files
strFileName = strFile.Name
strExtension = objFS.GetExtensionName(strFile)
If strExtension = "pst" Then
gobackup = msgbox ("Voulez vous sauvegarder le fichier" & strFile.Name, vbYesNo)
If gobackup = vbYes then
objFS.CopyFile strFile , Pst_Folder & "\" & strFileName,true
else
End If
End If
Next
End Sub
'==================================================================================================================
'Fonction après avoir appuyé sur le bouton continuer.
'Vérifie si un choix est coché et execute le backup de l'option sélectionné.
'==================================================================================================================
Sub backup
dim reponse
if ((Doc.Checked = false) AND (Bur.Checked = false) AND (PST.Checked = false)) then
Msgbox "Veuillez sélectionner une option avant de continuer"
else
reponse = msgbox ("La sauvegarde peut durer plusieurs minutes, voulez vous continuez ?", vbYesNo)
If reponse = vbYes then
If Doc.Checked Then
backup_Doc()
End if
If Bur.Checked Then
backup_Bur()
End if
If PST.Checked Then
backup_PST(objFolder)
End if
MsgBox "Sauvegarde terminée"
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Exec("Explorer " & racine)
fermer()
else
msgbox "Sauvegarde annulée"
fermer()
End If
End if
End Sub
</SCRIPT>
<br>
<br>
<br>
<input type="button" id="valider" name="valider" value="Continuer" onclick="backup()">
<input type="button" value="Fermer" border="none" OnClick="fermer()">
</body>
</html> |
Partager