We help IT Professionals succeed at work.

FTP via VBS script

duncan320
duncan320 asked
on
Medium Priority
687 Views
Last Modified: 2008-02-01
I have very basic knowledge of writing .vbs scripts.

I need a very basic script that will copy say all *.sql from a server to say c:\ftp on the PC it is been run on, i have no idea how to do this, but i need to do the following :

connect to the ftp server
with username & password
change into a certain directory say /etc/backup on the remote server
and then copy *.sql to c:\ftp
disconnect

Can someone please provide me with an example.  Im sure this will be a few lines of code, but it knowing what.

Many Thanks
Comment
Watch Question

This is not a few lines of code, it is a little bit more involve. Are you using vb6?
Here is a sample codes from freevbcode.com. Good place to get samples and they have few sample codes for FTP.

http://freevbcode.com/ShowCode.Asp?ID=731

Author

Commented:
I was hoping to do it with a VBS script if i can.

Have tried the like given by lunchbyte but it wont let me download the file it says its invalid or corrupted.

Thanks
CERTIFIED EXPERT
Commented:
You can do this in a batch file
in your batch file add
FTP -s:ftpscript.txt ftpserver  ' ftpserver is your ftp server

in ftpscript.txt or whatever you want to name it put

username
password
cd /etc/backup
binary
mget *.sql
bye

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.