VB and VBA Users Source Code: Using FTP with VB Script to transfer files remotely
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Using FTP with VB Script to transfer files remotely
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Wednesday, February 19, 2003
Hits:
1726
Category:
Internet/Remote Comms
Article:
Below is some sample VBScript which put and gets a file from a remote FTP server. '-------Place this code in a file called C:\Test.vbs Dim oShell Dim sFTPCommand Dim lWindowStyle Dim bWaitForCompletion 'Initialise the FTP Command sFTPCommand = "ftp -n -v -s:C:\FTPScript.txt" lWindowStyle = 8 bWaitForCompletion = True 'Create the Windows Scripting Host shell Set oShell = CreateObject("WScript.Shell") 'Run the FTP program, using the text file for the files to be transferred oShell.Run sFTPCommand, lWindowStyle, bWaitForCompletion 'Display a message to confirm transfer has completed oShell.Popup "File transfer has completed", 10, "FTP Script", 0 Set oShell = Nothing '-------Place this FTP script in a file called c:\FTPScript.txt (remove the comments) ' open efg.barcap.com ' user ' myusername ' mypassword ' binary ' put "C:\test.jpg" /in/test.jpg ' get "/in/test.jpg" "C:\apps\test.jpg" ' bye ' quit
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder