home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / FTPSchedul70417492002.psc / ModAutoExec.bas < prev    next >
Encoding:
BASIC Source File  |  2002-04-09  |  1.7 KB  |  55 lines

  1. Attribute VB_Name = "ModAutoExec"
  2. '*********************************************************************
  3. 'Purpose:   This exe is used to execute the automated transfer of files.
  4. 'Scope:     Self Contained exe.
  5. 'Inputs:    Nothing
  6. 'Returns:   Nothing
  7. '*********************************************************************
  8. Sub Main()
  9. 'Local Variables
  10. Dim ftp As FTP_JPC.CFTP_JPC 'DLL created to perform FTP.
  11. Dim rec As ADODB.Recordset
  12. Dim fso As Object
  13. Dim strFile As String
  14. Dim boolRet As Boolean      'Future use in logging.
  15.  
  16. 'Instantiate variables.
  17. Set ftp = New FTP_JPC.CFTP_JPC
  18. Set rec = New ADODB.Recordset
  19. Set fso = CreateObject("Scripting.FileSystemObject")
  20. strFile = App.Path & "\Schedule.xml"
  21.  
  22. 'If the file actually existis perform the execution.
  23. If fso.FileExists(strFile) Then
  24.     'Open the .xml File.
  25.     rec.Open strFile
  26.     
  27.     'Step through each item in the list and transfer the requested files.
  28.     Do While Not rec.EOF
  29.         'Open the connection to the server.
  30.         If ftp.FTPConnect(rec("Remote Server"), rec("Remote UID"), rec("Remote PWD")) = True Then
  31.             'Change the directory.
  32.             If ftp.ChangeDirectory(rec("Remote Path")) = True Then
  33.                 'Transfer the file.
  34.                 If ftp.FTPTransfer(rec("Remote File"), rec("Local Path") & "\" & rec("Local File")) Then
  35.                     ftp.FTPDisconnect
  36.                     boolRet = True
  37.                 Else
  38.                     boolRet = False
  39.                 End If
  40.             Else
  41.                 boolRet = False
  42.             End If
  43.         Else
  44.             boolRet = False
  45.         End If
  46.         
  47.     rec.MoveNext
  48.     Loop
  49.     
  50.     rec.Close
  51.     
  52. End If
  53.  
  54. End Sub
  55.