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
| Call ftpList
Private Function ftpList()
Dim myShell
set ftpList = nothing
strConnect = "ftp.symantec.com/public/english_us_canada/antivirus_definitions/norton_antivirus/"
Set myShell = CreateObject("Shell.Application")
'If strUser <> "" Then strConnect = strUser & ":" & strPassword & "@"
Set ftpList = myShell.Namespace("FTP://" & strConnect).Items
'''''
debugFileList ftpList
'''''
set myShell = Nothing
End Function
'====================
Private Sub debugFileList(myListe)
dim spc
For Each F In myListe
s = s & f.Name & String((35-Len(f.name))/6,vbTab) & " Size = " & Convert(F.Size) _
& String((12-Len(Convert(F.Size)))/4,vbTab) & " Modification : " & f.ModifyDate & vbnewline
next
MsgBoxPlus S, "", "Lister les fichiers FTP",900
End Sub
'====================
Private Function MsgBoxPlus(Msg, btnType, sTitle, MaxnumCharToDisplay)
Dim nbMessages, Compt, RetMsg(500), I, K, NumRC, tmp
If sTitle = "" Then sTitle = Wscript.ScriptName
NumRC = Ubound(Split(Msg, vbCrLf))-2
nbMessages = Round((Len(Msg)-2*NumRC)/MaxnumCharToDisplay + 0.4)-1
If btnType = "" Then btnType = vbYesNoCancel Or vbOkOnly
If MaxnumCharToDisplay > 800 Then MaxnumCharToDisplay = 800
I = 0
For K = Lbound(Split(Msg, vbCrLf)) To Ubound(Split(Msg, vbCrLf))
RetMsg(i) = RetMsg(i) & Split(Msg, vbCrLf)(K) & vbCrLf
If Len(RetMsg(i)) >= MaxnumCharToDisplay Then
I =I + 1
End If
Next
tmp = 0
For Compt = 0 To nbMessages
If RetMsg(Compt) = "" Then tmp = tmp + 1 ' cherche le nombre de messages vides
Next
tmp = tmp - 1 ' Il y a un message vide en trop, on l'enlève
For Compt = 0 To nbMessages
If RetMsg(Compt) <> "" Then
' Si le nombre de messages est important, on peut arrêter le script avec "Annuler"
dim Reponse
Reponse = MsgBox(RetMsg(Compt),btnType , sTitle)
If Reponse = vbCancel Then ' On quit Wscript
WScript.Quit 0
ElseIf Reponse = vbNo Then ' On sort de la fonction
Exit Function
Else
'OK = continue l'affichage des messages
End If
End If
Next
End Function
'===================
Public Function Convert(Sz)
Dim SizePlus
If Sz < 1024 Then
SizePlus = CStr(Sz) + " Oct"
ElseIf Sz >= 1024 And Sz < 819200 Then
SizePlus = CStr(FormatNumber((Sz / 1024), 2)) + " Ko"
ElseIf Sz >= 8912 And Sz < 1027604480 Then
Sz = Sz / 1024
SizePlus = CStr(FormatNumber(Sz / 1024, 2)) + " Mo"
ElseIf Sz >= 1027604480 Then
Sz = Sz / 1024
Sz = Sz / 1024
SizePlus = CStr(FormatNumber(Sz / 1024, 2)) + " Go"
End If
Convert = SizePlus
End Function |
Partager