Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ftp vs copy

Posted on 2003-10-28
5
Medium Priority
?
361 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 28

Accepted Solution

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

Assisted Solution

by:vinnyd79
vinnyd79 earned 450 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 450 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 150 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 150 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

688 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