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
|
'====================================== Compresser dans un dossier temporaire TEMP ======================================
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim Source, Destination, MyHex, MyBinary, i
Dim oShell, oApp, oFolder, oCTF ', oFile
Dim oFileSys
Source = "D:\Sites\"
Destination = "C:\Temp\archive.zip"
Destination_Final = "C:\Sauvegardes\Sites\Sauvegardes.zip"
MyHex = _
Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
For i = 0 To UBound(MyHex)
MyBinary = MyBinary & Chr(MyHex(i))
Next
Set oShell = CreateObject("WScript.Shell")
Set oFileSys = CreateObject("Scripting.FileSystemObject")
'Creation du zip
Set oCTF = oFileSys.CreateTextFile(Destination, True)
oCTF.Write MyBinary
oCTF.Close
Set oCTF = Nothing
Set oApp = CreateObject("Shell.Application")
Set oFolder = oApp.NameSpace(Source)
If Not oFolder Is Nothing Then _
oApp.NameSpace(Destination).CopyHere oFolder.Items
wScript.Sleep 5000
'Set oFile = Nothing
'On Error Resume Next
'===================== Renommer avec la date du jour et déplacement vers destination finale ================
Dim variable
set FSO = CreateObject("Scripting.FileSystemObject")
set oF1 = FSO.GetFile("C:\Temp\archive.zip")
'renommer avec la date du jour
sLog = Date()&"_"&Time()
madate = Replace(CStr(Date),"/","_")
montime = Replace(CStr(Time),":","_")
'sLog=Date()
wscript.echo madate
wscript.echo "l'extension du fichier : " & sLog
'oF1.move "C:\Sauvegardes\Sites\masauvegarde.zip"
'variable = "C:\Sauvegardes\Sites\masauvegarde.zip"
wscript.echo "la valeur de la variable : " & variable
'oF1.Move variable
Wscript.echo "Nom du fichier : " & oF1.Name
env=oF1.Name
wscript.echo "env = " & env
env_bis = madate & montime & env
car = "C:\Sauvegardes\Sites\"
env_dos= car & env_bis
wscript.echo "env_bis :" & env_bis
wscript.echo "car =" &car
wscript.echo "env_dos = " & env_dos
oF1.Move env_dos |
Partager