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
| '-----------------------------------------
'Compression les logs pour archivage
'-----------------------------------------
Sub COMPRESS
msglog "0","0000","---Debut: Compression
Set oShell = CreateObject("WScript.Shell")
Set oFileSys = CreateObject("Scripting.FileSystemObject")
ListeSrv = "Charge;comptes;reçus"
ListeCommon = "editions;resultats;production"
msglog "0","0000","---Debut: Compression
For Each Centre In Split(ListeCentre,";",-1)
Source = "C:\appli\Traitement\" & Centre & "\log"
Destination = "K:\Sauvegarde\Traitement\log_" & Centre & "_" & MyDate & ".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 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 100000
Set oFile = Nothing
msglog "0","0000","---Fin: Compression
Next
msglog "0","0000","---Debut: Compression
For Each Srv In Split(ListeSrv,";",-1)
Source1 = "C:\appli\Traitement\Export_" & Srv & "\log"
Destination1 = "K:\Sauvegarde\Traitement\Log_" & Srv & "_" & MyDate & ".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 oCTF = oFileSys.CreateTextFile(Destination1, True)
oCTF.Write MyBinary
oCTF.Close
Set oCTF = Nothing
Set oApp = CreateObject("Shell.Application")
Set oFolder = oApp.NameSpace(Source1)
If Not oFolder Is Nothing Then _
oApp.NameSpace(Destination1).CopyHere oFolder.Items
wScript.Sleep 100000
Set oFile = Nothing
msglog "0","0000","---Fin: Compression
Next |
Partager