Automate FTP file transfers - free tool

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
donj
Posts: 416
Last visit: Thu May 29, 2008 5:08 am

Automate FTP file transfers - free tool

Post by donj »

One of the most-requested items here on ScriptingAnswers.com is a way to automate FTP transfers - something more robust that simple input scripts for the built-in FTP.exe app. well, ask no more, just go to http://www.primalscript.com/freetools and download the new FTP COM object. With it, you can connect to FTP sites (providing credentials if needed) and Get and Put files using simple Get() and Put() methods. Quick, easy, and the download includes samples showing how to use it - you can even check for failed connections and transfers using status codes returned by the various methods. Free, free, free. Enjoy.
PS. Works great in VBScript, PowerShell, KiXtart, JScript - any language that supports COM. Included samples are in VBScript.
User avatar
bbright20
Posts: 27
Last visit: Tue Dec 07, 2010 10:50 pm

Automate FTP file transfers - free tool

Post by bbright20 »

Unfortunately, turning off the firewall would not be an option - corporate idiots blocking stupid stuff! :)

Is there any other method I can try to get around this issue? I plugged in the port number (the script said to put whatever port # is used if default is not used)...The one I put in was 22...

Is it possible to try and login using IE with the "username:password@address" method? If that works, should the script then work as well?

I'm really trying to find out what the cause is here...like I said, I can use a gui program to access it, but not the script...and it's something I have to download daily...would be SOOO much easier to just run a script.

Thanks.
User avatar
bbright20
Posts: 27
Last visit: Tue Dec 07, 2010 10:50 pm

Automate FTP file transfers - free tool

Post by bbright20 »

I don't have access to turn off the firewall, so as I said, that is not an option. I'm a user on a network, and I don't have admin rights to view the logs or shut off the firewall.

I changed the passive line to read a 0 and I now get "connection to server was reset" message.

I did test accessing the ftp site directly through IE, and it worked fine.

If it means anything, I am able to run various other scripts connecting to various network drives...I don't run anything that connects out of network though.

Also, when I run the test script included in the download, I am able to successfully download the MS_README.TXT file to the correct destination.bbright202008-02-08 08:25:19
User avatar
bbright20
Posts: 27
Last visit: Tue Dec 07, 2010 10:50 pm

Automate FTP file transfers - free tool

Post by bbright20 »

I was able to connect to the server through this script...even got the "starting download" echo...however, seconds after the starting download, I got this really wierd "Hé
User avatar
bbright20
Posts: 27
Last visit: Tue Dec 07, 2010 10:50 pm

Automate FTP file transfers - free tool

Post by bbright20 »

do you have any idea what the "he" error is?
User avatar
bbright20
Posts: 27
Last visit: Tue Dec 07, 2010 10:50 pm

Automate FTP file transfers - free tool

Post by bbright20 »

Code: Select all

'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2007
'
' NAME: 
'
' AUTHOR: Alexander Riedel , SAPIEN Technologies, Inc.
' DATE  : 9/12/2007
'
' COMMENT: 
'
'==========================================================================
Dim oftp
Set oftp = CreateObject("Primalscript.FTPTransfer")
oftp.Passive = 1 ' set the passive flag if needed
' oftp.Port =  ' Set whatever port you are using if not the default ftp port
if oftp.Connect("ftp.*************.com","USERNAME","PASSWORD") = 0 Then
 WScript.Echo oftp.Status
else
 WScript.Echo "Starting download"
 If oftp.Get("/OUT/FILE.TXT","C:TEMPFILE.TXT") = 0 Then
  WScript.Echo oftp.Status
 Else
  WScript.Echo "Download complete"
 End If
 oftp.Disconnect
end If

I've omitted the site name, username and password. Other than that, that's the code I use when I get the error.

The FTP site I am attempting to has a specific login username and password - which I use to login using WSFTP Pro.

Yes, I can login using the sample script. It works fine.

bbright202008-02-11 12:49:44
User avatar
bbright20
Posts: 27
Last visit: Tue Dec 07, 2010 10:50 pm

Automate FTP file transfers - free tool

Post by bbright20 »

I opened the WSFTP program and watched everything while I ran the script...to see if anything wierd was happening. I noticed that when I ran the script, I got the echo "Starting Download", a second later I noticed on the local side of WSFTP (I was watching the folder I want the file downloaded to), the file that was already there disappeared. I don't know where it went, but it was removed from that folder. Right after that, I got the wierd error. I've even gotten an "Xe" error code too.

How do I check through NETSH?
This topic is 16 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked