INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Backups

VAL Backup VBScript by Ronster
Posted: 22 Aug 08 (Edited 2 Sep 08)

This code relies heavily on the posts in this thread: http://www.tek-tips.com/viewthread.cfm?qid=1191903&page=1

It helped me not only to backup my wav files but also learn some VBScript.

So a big thanks to JtheRipper and tsuji.

I added some message box prompts and a case statement to put in the IP address when given the board location.  This needs to be coded into the script, but it saves looking up the IP address when you want to backup.

CODE

' valbackup.vbs
' VBScript to Backup VAL Boards.
' Version 1.0 - August 2008
' --------------------------------------
'This script is a combination of a script posted on tek-tips: http://www.tek-tips.com/viewthread.cfm?qid=1191903&page=1
'and another script that I found on the web but couldn't re-find!
' Additional work to make the input and the download parts work together  and some tweaking was carried out by
' Ronnie Cassels.   http://www.linkedin.com/in/ronniecassels

Option Explicit
Dim objFSO, objMyFile, objShell, strFTPScriptFileName, objFolder, strDirectory, outFile, objArgs
Dim strLocalFolderName, strFTPServerName, strLoginID, strFTPServerDir
Dim strPassword, strFTPServerFolder, objPassword, strPath, FolderContent, fso, CleanPath, file, Flag
Dim strMbox, VALIP, VALLogin, VALPwd, VALLoc

strMbox = MsgBox("Do you want to backup your wav files?",4,"VAL Backup")
If strMbox = 6 Then
    strDirectory = InputBox("Enter the name for the new directory:","Set Backup Directory","J:\IT\Voice\Avaya_Backup\VAL_Boards")
Else
    WScript.Quit
End If


' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Note If..Exists. Then, Else ... End If construction
If objFSO.FolderExists(strDirectory) Then
   Set objFolder = objFSO.GetFolder(strDirectory)
   WScript.Echo strDirectory & " already created "
Else
   Set objFolder = objFSO.CreateFolder(strDirectory)
WScript.Echo "Backup directory created " & strDirectory
End If

'###########################################################################'
'This section will need to be updated with VAL Location and associated IP.
VALLoc = InputBox("Enter the Location of the VAL Board:","VAL Location","04d07")
select case VALLoc
    Case "03a07"
        VALIP = "170.123.1.136"
    Case "04d07"
        VALIP = "170.123.1.137"
    Case "05a07"
        VALIP = "170.123.1.138"
    Case Else
    msgbox "Unknown VAL Board.  Please edit valftp.vbs to add a new board."
    WScript.Quit
end select
'###########################################################################'



VALLogin = InputBox("Enter your login for the VAL Board:","VAL Login","")
VALPwd = InputBox("Enter your password for the VAL Board:","VAL Password","")


' Change this, foldername = local dir (where files must be ftp'd TO)
strLocalFolderName = strDirectory

' Server where you are ftp'ing TO
strFTPServerName = VALIP

' Username you use to ftp
strLoginID = VALLogin

' Initialize variables
strPassword = VALPwd
strFTPServerDir = ""

' Change this to the folder where the files are on the source server
'strFTPServerFolder = "/"

'The follow lines of code generate the FTP script file on the fly,
'because the directory name changes every time its run

strFTPScriptFileName = strLocalFolderName & "\FTPScript.txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")

If (objFSO.FileExists(strFTPScriptFileName)) Then
    objFSO.DeleteFile(strFTPScriptFileName)
End If

Set objMyFile = objFSO.CreateTextFile(strFTPScriptFileName, True)
'objMyFile.WriteLine ("ftp -s open " & strFTPServerName)
'objMyFile.WriteLine ("open " & strFTPServerName)
'objMyFile.WriteLine (strLoginID)

'strPassword = InputBox("Please enter your password:")
'objMyFile.WriteLine (strPassword)

'strFTPServerDir = InputBox("Enter directory from which to ftp:")

objMyFile.WriteLine ("cd " & strFTPServerFolder & strFTPServerDir)
objMyFile.WriteLine ("open " & strFTPServerName)
objMyFile.WriteLine (strLoginID)
objMyFile.WriteLine (strPassword)
objMyFile.WriteLine ("bin")
objMyFile.WriteLine ("prompt")
objMyFile.WriteLine ("lcd " & strLocalFolderName)
objMyFile.WriteLine ("mget .wav")
objMyFile.WriteLine ("bye")
objMyFile.Close



'The following code executes the FTP script. It creates a Shell
'object and run FTP program on top of it.
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run ("ftp -s:" & chr(34) & strFTPScriptFileName & chr(34)),,True
'objShell.Run (strFTPScriptFileName & chr(34))
Set objShell = Nothing

objFSO.deletefile strFTPScriptFileName,true

Set objFSO = Nothing
Set objMyFile = Nothing


Set fso=CreateObject("Scripting.FileSystemObject")
'CleanPath="c:\temp\test"

For Each file In fso.GetFolder(strLocalFolderName).Files
Flag = StrComp(file, strFTPScriptFileName ,1)
'if Flag = 0 then
'   file.delete
'end if
Next

Back to Avaya: CM/Aura (Definity) FAQ Index
Back to Avaya: CM/Aura (Definity) Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close