Solved

ftp vs copy

Posted on 2003-10-28
5
358 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

776 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