Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 828
  • Last Modified:

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

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
ezjurgen
Asked:
ezjurgen
  • 2
1 Solution
 
fattumsdadCommented:
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
 
fattumsdadCommented:
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now