Solved

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

Posted on 2004-08-12
4
802 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
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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run Powershell Script When New File Is In A Folder 3 64
countEvens challenge 2 78
sum67 challenge 35 93
object oriented javascript web form 8 107
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

867 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