Solved

ftp vs copy

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

758 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