Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


auto ftp download

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,31119
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> auto ftp download
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 auto ftp download - 2/15/2006 6:32:33 PM   
  pork1977

 

Posts: 3
Score: 0
Joined: 2/15/2006
Status: offline
Hiya,
I was wondering, my knowledge with vbscript is not too good and as of current I'm trying to create a script that when run automaticaly downloads all files in the root of the ftp location just to the root of my c drive - have done some digging around and come up with this script which works fine.....

set ftp = CreateObject("ChilkatFtp2.ChilkatFtp2")
ftp.UnlockComponent "any string begins the 30-day trial"
ftp.Username = "username"
ftp.Password = "pswd"
ftp.Hostname = "ftp.my.site."
ok = ftp.Connect()
if (ok <> 1) then
   MsgBox ftp.LastErrorText
end if
' Download all files in the current remote FTP directory
' matching a pattern to a local directory.
localDir = "c:\"
remotePattern = "*.*"
numDownloaded = ftp.MGetFiles(remotePattern, localDir)

Only thing is, this script uses the 'Chilkat' activeX component to retrieve the files (I think I got that right!) and I wanted to know if windows (microsoft) has it's own so I needn't install any other third party software - if so how the hell would I modify this script ?!?
Any help would be greatly appreciated
 
 
Post #: 1
 
 RE: auto ftp download - 2/15/2006 9:10:18 PM   
  ginolard


Posts: 1043
Score: 21
Joined: 8/10/2005
Status: offline
You could just write an FTP script and then use the Shell.Run method to run FTP passing the FTP script as a parameter.

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to pork1977)
 
 
Post #: 2
 
 RE: auto ftp download - 2/15/2006 9:49:01 PM   
  pork1977

 

Posts: 3
Score: 0
Joined: 2/15/2006
Status: offline
OK then thank you
How would you create this other script, some examples would be fantastic!

I will have a look now for some examples myself as I'm not really a great programmer and am still learning myself so struggling

Would it mean I could still use the one I have but with a few modifications? If so do I need to change the first line only?

(in reply to ginolard)
 
 
Post #: 3
 
 RE: auto ftp download - 2/15/2006 11:14:32 PM   
  ginolard


Posts: 1043
Score: 21
Joined: 8/10/2005
Status: offline
An FTP script is simply a list of FTP commands one after the other.  For example.

Open myhost.com
mylogin
mypassword
lcd c:\temp
CD \etc
binary
mput *.gz
y
Close
Quit

That script connects to myhost.com with the login mylogin and password mypassword.  It then changes directory on the local machine to C:\temp, changes directory on the remote machine to \etc and then transfers all files with .gz extension from the local machine to the remote machine.

To execute that in a vbscript simply save it a file with the extension SCR (e.g. ftp.scr) and run it via the shell method.  Like so

Set WShell = CreateObject("WScript.Shell")

WShell.Run "ftp -s:c:\temp\ftp.scr",0

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to pork1977)
 
 
Post #: 4
 
 RE: auto ftp download - 2/16/2006 12:27:24 AM   
  pork1977

 

Posts: 3
Score: 0
Joined: 2/15/2006
Status: offline
that's fantastic, thank you very much, do both files need to be in the same directory or can you have them aprt and point to the location of scr file from the vbscript?

(in reply to ginolard)
 
 
Post #: 5
 
 RE: auto ftp download - 2/16/2006 8:28:47 AM   
  ginolard


Posts: 1043
Score: 21
Joined: 8/10/2005
Status: offline
The .scr file can be wherever you like.  Just make sure the path of the SHell.run command points to it.

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to pork1977)
 
 
Post #: 6
 
 RE: auto ftp download - 2/16/2006 8:36:17 AM   
  Cybex


Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
Pork1977,
Glad to see you finally made it to a site that will actually help you.
Sorry i wasn't able to help you more eariler.

Cybex

_____________________________

Common sense is not so common.

(in reply to ginolard)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> auto ftp download Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts