Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-08-12
4
Medium Priority
?
821 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:fattumsdad
ID: 11822608
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 200 total points
ID: 11822675
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

670 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