Dim azipper, cheminwinzip, cibleduzip
Set objShell = CreateObject("Shell.Application")
Set WshShell = WScript.CreateObject("WScript.Shell")
cibleduzip = "D:\www\_aArchiver\Applis\EMS.zip"
azipper = "D:\www\EMS"
WshShell.Run "WINZIP32.exe" & " -a -r " & """" & cibleduzip & """" & " " & """" & azipper & """"
cibleduzip = "D:\www\_aArchiver\Applis\FichesLiaisonEDP.zip"
azipper = "D:\www\FichesLiaisonEDP"
WshShell.Run "WINZIP32.exe" & " -a -r " & """" & cibleduzip & """" & " " & """" & azipper & """"
cibleduzip = "D:\www\_aArchiver\Applis\NCP.zip"
azipper = "D:\www\NCP"
WshShell.Run "WINZIP32.exe" & " -a -r " & """" & cibleduzip & """" & " " & """" & azipper & """"
cibleduzip = "D:\www\_aArchiver\Applis\SaisieStats.zip"
azipper = "D:\www\SaisieStats"
WshShell.Run "WINZIP32.exe" & " -a -r " & """" & cibleduzip & """" & " " & """" & azipper & """"
cibleduzip = "D:\www\_aArchiver\Applis\StatsEDP.zip"
azipper = "D:\www\StatsEDP"
WshShell.Run "WINZIP32.exe" & " -a -r " & """" & cibleduzip & """" & " " & """" & azipper & """"
'temporisation 30 sec pour finir le zip
WScript.Sleep 30000
'Backup FTP
Set FSys = CreateObject("Scripting.FileSystemObject")
Set MonFichierBat = FSys.CreateTextFile("D:\www\_ScriptsArchivage\backupApplis.bat")
Dim ipFTP
ipFTP = "nn.nnn.nn.nnn"
'Nom du répertoire dont le contenu est à sauvegarder, SANS le \ à la fin
Dim oRep
oRep = "D:\www\_aArchiver\Applis\"
Dim horodate
horodate = Replace(Date(),"/","_") & "__" & Replace(Time(),":","_")
'dans le dossier : "Backup"
dossierArchivage = "Applis_" & horodate
With MonFichierBat
.writeLine "echo open """ & ipFTP & """ > c:\temp\monftp.ftp"
.writeLine "echo backup>> c:\temp\monftp.ftp"
.writeLine "echo backup>> c:\temp\monftp.ftp"
.writeLine "echo mkdir """ & dossierArchivage & """>> c:\temp\monftp.ftp"
.writeLine "echo cd """ & dossierArchivage & """>> c:\temp\monftp.ftp"
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim oSousRep
Dim oFichier
.writeLine "echo prompt>> c:\temp\monftp.ftp"
.writeLine "echo mput """ & oRep & "\*.*" & """>> c:\temp\monftp.ftp"
If oFSO.FolderExists(oRep) Then
For each oSousRep in oFSO.GetFolder(oRep).SubFolders
'je créé le sous dossier correspondant et je me place dedans (je suis dans le dossierArchivage)
.writeLine "echo mkdir """ & oSousRep.Name & """>> c:\temp\monftp.ftp"
.writeLine "echo cd """ & oSousRep.Name & """>> c:\temp\monftp.ftp"
'j'y copie tous les fichiers
.writeLine "echo mput """ & oRep & "\" & oSousRep.Name & "\*.*" & """>> c:\temp\monftp.ftp"
'je me repositionne dans le dossierArchivage
.writeLine "echo cd ..>> c:\temp\monftp.ftp"
Next
End If
.writeLine "echo prompt>> c:\temp\monftp.ftp"
.writeLine "echo bye>> c:\temp\monftp.ftp"
.writeLine "FTP -s:c:\temp\monftp.ftp"
.writeLine "del c:\temp\monftp.ftp"
.writeLine "echo O | del D:\www\_aArchiver\Applis\*.*"
.Close
End With
Dim shell, commande
Set shell = WScript.CreateObject("WScript.Shell")
commande="D:\www\_ScriptsArchivage\backupApplis.bat"
shell.Run commande, 0,true
WScript.quit
Aucun commentaire:
Enregistrer un commentaire