Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop to upload files not working

Status
Not open for further replies.

pbuddy2007

Technical User
Feb 9, 2008
17
0
0
CA
I'm using a loop to upload all the files in a folder to a FTP server using the code below. The problem is that often not all the files are uploaded ????

Code:
Dim i As Long
  Dim sError      As String
  Dim strFullPath As String, strRelativeName As String, strRelativePath As String
  Dim objFTP As ASPFTP
  Dim strMsg
  Dim profilenum As Integer
  Dim tdesign As String
  
  Dim wsh

'On Error Resume Next
Set wsh = CreateObject("WScript.Shell")

  
    
  PathLogInit
  LogPath App.Path & "\output\site1", strFNAMES, lngPptrs, strPaths
  
  'create reference to object
  Set objFTP = New ASPFTP
  
  objFTP.sServerName = "1.2.3.4"
  objFTP.sUserID = "user"
  objFTP.sPassword = "pass"
  
  If objFTP.bConnect() Then
    objFTP.bMakeDir "HTTPDOCS\site3"
    
    For i = 1 To UBound(strFNAMES)
    
      strFullPath = strPaths(lngPptrs(i)) & strFNAMES(i)
      strRelativeName = GetRelativeName(strFullPath)
      strRelativePath = GetRelativePath(strFullPath)
      strRelativePath = "\HTTPDOCS\site3" & strRelativePath
      strRelativeName = "\HTTPDOCS\site3" & strRelativeName
      

        
      'now make the directory
      Label5.Caption = "Creating folder " & strRelativePath & vbCrLf
      DoEvents
      objFTP.bMakeDir strRelativePath
      Label5.Caption = "Copying file " & strRelativeName & vbCrLf
      DoEvents
      objFTP.bPutFile strFullPath, strRelativeName
    Next i
    Set objFTP = Nothing
else

  'error code
end if
 
Could it be that the missing files were added to the directory after the PathLog process completed?

Does the FNames array index always begin with 1, instead of 0?

Depending on these answers, you may have to check the PathLog process to see how it builds the FNames list.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top