Solved

ftp vs copy

Posted on 2003-10-28
5
357 Views
Last Modified: 2010-05-03
We need to copy multiple files from 1 server to another on regular basis.
Copy is not fast enough. I was told, ftp may be faster ?

Also, if ftp is a better way to do it, how would I code it from VB ?

Thank You
-Alex
0
Comment
Question by:AlexF777
  • 3
5 Comments
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 150 total points
ID: 9635214
Yes FTP would be faster.
0
 
LVL 28

Assisted Solution

by:vinnyd79
vinnyd79 earned 150 total points
ID: 9635223
There is a good class module you can use from this project:

http://www.freevbcode.com/ShowCode.ASP?ID=1593
0
 
LVL 28

Assisted Solution

by:vinnyd79
vinnyd79 earned 150 total points
ID: 9635239
There is also a free FTP control on this page:

http://www.chilkatsoft.com/downloads.asp
0
 
LVL 9

Assisted Solution

by:Dang123
Dang123 earned 50 total points
ID: 9635389
You may also try something like this


Public Sub TransferFileFTP()
    '*****************************************************************************************
    '
    ' Parameters:       none
    '
    ' Global Updates:   none
    '
    ' Global Read:      No global variables should be read
    '
    ' Return:           No return value - Sub
    '
    ' Description:
    '   Control FTP transfer.
    '
    '*****************************************************************************************
    On Error GoTo ErrorCode
   
    Dim hndFile         As Integer
    Dim strFTP          As String
    Dim strBAT          As String
    Dim strLOG          As String
    Dim strPath         As String
   
    strPath = App.Path & "\"
    strFTP = strPath & "FileFTP.FTP"
    strBAT = strPath & "FileFTP.BAT"
    strLOG = strPath & "FileFTP.LOG"
   
    hndFile = FreeFile
    Open strFTP For Output As #hndFile
    Print #hndFile, "open RemoteMachine"
    Print #hndFile, "user someid"
    Print #hndFile, "password"
    Print #hndFile, "GET ""RemoteFile1.txt"" ""LocalFile1.txt"""
    Print #hndFile, "GET ""RemoteFile2.txt"" ""LocalFile2.txt"""
    Print #hndFile, "GET ""RemoteFile3.txt"" ""LocalFile3.txt"""
    Print #hndFile, "BYE"
    Close #hndFile
   
    hndFile = FreeFile
    Open strBAT For Output As #hndFile
    Print #hndFile, "ftp -n -s:""" & strFTP & """ > """ & strLOG & """"
    Close #hndFile
   
    Call Shell(strBAT, vbHide)
   
    Exit Sub
ErrorCode:
    Select Case Err.Number
        Case Else
            Err.Raise Err.Number, , "clsProcessRequest UploadFileFTP - " & Err.Description
    End Select
End Sub
0
 
LVL 14

Assisted Solution

by:aelatik
aelatik earned 50 total points
ID: 9636107
Use the INET control, this piece of script will fetch the entire FTP Directory for you...

    With Inet1
        .URL = "FTP://255.255.255.255"
        .UserName = "username"
        .Password = "password"
        .RemotePort = 21
        .Execute , "CD FILES/IMAGES"
         While .StillExecuting: DoEvents: Wend
        .Execute , "DIR"
         While .StillExecuting: DoEvents: Wend
         For Each Item In Split(.GetChunk(1024, icString), vbCrLf)
            If ARRAY_ITEM <> "" Then
                 While .StillExecuting: DoEvents: Wend
                .Execute , "GET " & Item & " C:\TEMP\" & Item
            End If
        Next
         Execute , "QUIT"
    End With
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now