Solved

VBScript to retrieve, from FTP, Unrar and copy to CLients with Log

Posted on 2004-08-12
4
800 Views
Last Modified: 2008-02-01
Hi, I'm quite new to VBScript (made some logon scripts etc) but I need to shedule a script that will download a RAR archive from an FTP server, unpack it and copy it to several desktops. I now run 4 diff programs who seem to take turns in not working. Therefore I need some log created too..

Can anyone help?


thanks
0
Comment
Question by:ezjurgen
  • 2
4 Comments
 
LVL 1

Expert Comment

by:fattumsdad
Comment Utility
You can start with something like this:

Option Explicit
Dim objShell, objShell2
Set objShell = CreateObject("WScript.Shell")
Set objShell2 = CreateObject("WScript.Shell")

objShell.Run "ftp" 'open FTP
Wscript.Sleep 500 'Pause
objShell.SendKeys "open SERVER {ENTER}" 'ftp.whatever.whatever
objShell.SendKeys "USERNAME {ENTER}" 'FTP login name
objShell.SendKeys "PASSWORD {ENTER}" 'FTP password
objShell.SendKeys "get FILENAME" 'Name of the file you want to download
Wscript.Sleep 1000 'Pause

objShell2.Run "RAR APPLICATION" '(Winrar, Winzip, whichever)

WScript.Quit

After the line "objShell2.Run" you can continue with the objShell2.SendKeys method to execute commands within WinRar or whichever RAR application you are using.  Here is a link that should help you out a bit:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp

Hope this helps!
0
 
LVL 1

Accepted Solution

by:
fattumsdad earned 50 total points
Comment Utility
Oh!  To answer the rest of your question...  copying the file(s)....

dim filesys, tar

set filesys = CreateObject ("Scripting.FileSystemObject")

set tar = filesys.GetFile("C:\DIRECTORY\FILENAME.EXT") 'The file you want to copy
tar.Copy("D:\DIRECTORY\FILENAME.EXT") 'Where you want to copy the file to
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How can i know where the problem lies with this shell script? 5 105
has77  challenge 9 67
tripleUp challenge 7 65
count11 challenge 6 47
The purpose of this article is to demonstrate how we can use conditional statements using Python.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now