Solved

FTP via VBS script

Posted on 2006-10-25
7
660 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
0
Comment
Question by:duncan320
  • 2
7 Comments
 
LVL 5

Expert Comment

by:lunchbyte
ID: 17804639
This is not a few lines of code, it is a little bit more involve. Are you using vb6?
0
 
LVL 5

Expert Comment

by:lunchbyte
ID: 17804689
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
0
 
LVL 1

Author Comment

by:duncan320
ID: 17805298
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
0
 
LVL 20

Accepted Solution

by:
hes earned 125 total points
ID: 17807889
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
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question