Inet dossier

niketou Messages postés 295 Date d'inscription dimanche 4 mai 2003 Statut Membre Dernière intervention 6 décembre 2010 - 23 août 2003 à 23:13
pcpunch Messages postés 1243 Date d'inscription mardi 7 mai 2002 Statut Membre Dernière intervention 18 février 2019 - 24 août 2003 à 23:41
salut,quelqu'un sait comment telecharger tout les fichiers du dossier d'un site ou fpt,mais d'un dossier precis (ex:www.monsite.com/dossier/).
merci

3 réponses

cs_mistercool Messages postés 2 Date d'inscription mardi 25 mars 2003 Statut Membre Dernière intervention 24 août 2003
24 août 2003 à 00:48
voilà le lien qui va te donner la solution :

http://www.vbfrance.com/article.aspx?Val=2756
0
pcpunch Messages postés 1243 Date d'inscription mardi 7 mai 2002 Statut Membre Dernière intervention 18 février 2019 5
24 août 2003 à 23:41
Voici une fonction pour telecharger tous les fichiers d'un dossier sur un ftp!!

Public Function CopieFichierFtp(Url As String, Dossier As String, Destination As String)

Dim Reponse As String
'Declare l'url
Inet1.Url = Url

'Se place dans le dossier "dossier" de la racine du ftp
Inet1.Execute , "cd " & Dossier & "/"
Call InetAttente

'Lit le contenu
Inet1.Execute , "dir"
Call InetAttente

'Stocke la reponse du dir
Reponse = Inet1.GetChunk(1024)
Call InetAttente

'Decoupe de reponse pour recupération des fichiers
Dim Nom_Fic()
Dim Nb As Integer
Dim Tmp As String
Nb = 0

For i = 1 To Len(Reponse)If Mid(Reponse, i, 1) Chr(13) And Mid(Reponse, i + 1, 1) Chr(10) Then
Tmp = Replace(Tmp, Chr(13), "")
Tmp = Replace(Tmp, Chr(10), "")
If Mid(Tmp, 1, 1) <> "." And Tmp <> "" Then
ReDim Preserve Nom_Fic(Nb)
Nom_Fic(Nb) = Tmp
Nb = Nb + 1
Tmp = ""
Else
Tmp = ""
End If
Else
Tmp = Tmp & Mid(Reponse, i, 1)
End If
Next i

'recuperation du path du ftp
Dim PathFtp As String
Inet1.Execute , "pwd"
Call InetAttente
PathFtp = Inet1.GetChunk(1024)
Call InetAttente

'Copie des fichiers du ftp

For i = 0 To UBound(Nom_Fic)
'Affichage de l'operation en cours
Label1 = "Copie de " & Nom_Fic(i) & " vers " & Destination
Inet1.Execute , "get " & PathFtp & "/" & Nom_Fic(i) & " " & Destination & Nom_Fic(i)
InetAttente
Next i

End Function

Sub InetAttente()
Do While Inet1.StillExecuting = True
DoEvents
Loop
End Sub

'POUR L'utiliser EXEMPLE :
Private Sub Command1_Click()
CopieFichierFtp "Ftp://user:pass@ftp", "dossier/sousdossier", "c:\test"
End Sub

'Si exemple les fichier se trouve dans le dossier : image
CopieFichierFtp "Ftp://user:pass@ftp", "image", "c:\test"

Voila!! Si tu as besoin d'aide????
0
pcpunch Messages postés 1243 Date d'inscription mardi 7 mai 2002 Statut Membre Dernière intervention 18 février 2019 5
24 août 2003 à 23:41
J'ai oublier il faut un composant Inet1 et un label1
0
Rejoignez-nous