guys and gals,

I am a newb to vb, but have been using this script i built a few years ago. i have been trying to modify my current mess of a vb script to read my file exclusions from a text file, but for the life of me i cant get it to work.


Here is my original script

Set objShell = CreateObject("Wscript.Shell")

objSource = InputBox("Please enter the Path to the source Data: Example: C:\Source\Data", _
"Source Folder")
If objSource = "" Then
Wscript.Quit
Else
Wscript.Echo objSource
End If

objDestination = InputBox("Please enter the Path to Destination Folder: Example: C:\Target\Data", _
"Destination Folder")
If objDestination = "" Then
Wscript.Quit
Else
Wscript.Echo objDestination
End If

objdate1 = InputBox("Only get files Newer than yyyymmdd:" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Example: 20121126", _
"Files Newer Than Date")
If objdate1 = "" Then
Wscript.Quit
Else
Wscript.Echo objdate1
End If

objdate2 = InputBox("Only get files Older than yyyymmdd:" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Example: 20121126", _
"Files Older Than Date")
If objdate2 = "" Then
Wscript.Quit
Else
Wscript.Echo objdate2
End If

objlogpath = InputBox("Please enter the Path and name of the existing log folder: Example: C:\LogFolder\logname.txt" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "LOG FILE MUST HAVE A .TXT EXTENSION", _
"Log Path and Folder Folder")
If objlogpath = "" Then
Wscript.Quit
Else
Wscript.Echo objlogpath
End If

objcmd = "Robocopy"
objSource = """" & objSource & """"
objDestination = """" & objDestination & """"
objdate1 = "" & objdate1 & ""
objdate2 = "" & objdate2 & ""
objswitches = " /B /E /A-:SH /COPYATO /R:2 /W:5 /V /TEE /XJ "
ExcludeDir = Chr(32) & Chr(34) & "Windows" & Chr(34) & Chr(32) & Chr(34) & "Program Files" & Chr(34) & Chr(32) & Chr(34) & "blackberry" & Chr(34) & Chr(32) & Chr(34) & "Temporary Internet Files" & Chr(34) & Chr(32) & Chr(34) & "Cookies" & Chr(34) & Chr(32) & Chr(34) & "Application Data" & Chr(34) & Chr(32) & Chr(34) & "Favorites" & Chr(34) & Chr(32) & Chr(34) & "IECompatCache" & Chr(34) & Chr(32) & Chr(34) & "IETldCache" & Chr(34) & Chr(32) & Chr(34) & "Local Settings" & Chr(34) & Chr(32) & Chr(34) & "PrintHood" & Chr(34) & Chr(32) & Chr(34) & "PrivacIE" & Chr(34) & Chr(32) & Chr(34) & "SendTo" & Chr(34) & Chr(32) & Chr(34) & "Start Menu" & Chr(34) & Chr(32) & Chr(34) & "Templates" & Chr(34) & Chr(32) & Chr(34) & "Tracing" & Chr(34) & Chr(32) & Chr(34) & "Altiris" & Chr(34) & Chr(32) & Chr(34) & "Apps" & Chr(34) & Chr(32) & Chr(34) & "DRIVERS" & Chr(34) & Chr(32) & Chr(34) & "Program Files" & Chr(34) & Chr(32) & Chr(34) & "WINNT" & Chr(34) & Chr(32) & Chr(34) & "Adobe" & Chr(34) & Chr(32) & Chr(34) & "Intel" & Chr(34) & Chr(32) & Chr(34) & "RECYCLER" & Chr(34) & Chr(32) & Chr(34) & "Bluetooth Software" & Chr(34) & Chr(32) & Chr(34) & "UserData" & Chr(34) & Chr(32) & Chr(34) & "AuthLog" & Chr(34) & Chr(32) & Chr(34) & "I386" & Chr(34) & Chr(32) & Chr(34) & "Tools" & Chr(34) & Chr(32) & Chr(34) & "Acc2k7" & Chr(34) & Chr(32) & Chr(34) & "InterWise" & Chr(34) & Chr(32) & Chr(34) & "Lync Recordings" & Chr(34) & Chr(32) & Chr(34) & "Administrator" & Chr(34) & Chr(32) & Chr(34) & "All Users" & Chr(34) & Chr(32) & Chr(34) & "default user" & Chr(34) & Chr(32) & Chr(34) & "LocalService" & Chr(34) & Chr(32) & Chr(34) & "NetworkService" & Chr(34) & Chr(32) & Chr(34) & "My Videos" & Chr(34) & Chr(32) & Chr(34) & "My Music" & Chr(34) & Chr(32) & Chr(34) & "My Pictures" & Chr(34) & Chr(32) & Chr(34) & "Access Connections" & Chr(34) & Chr(32) & Chr(34) & "My Shapes" & Chr(34) & Chr(32) & Chr(34) & "Tracing" & Chr(34) & Chr(32) & Chr(34) & "QUARANTINE" & Chr(34) & Chr(34) & Chr(32) & Chr(34) & "Lync" & Chr(34) & Chr(32) & Chr(34) & "AT&T Connect" & Chr(34) & Chr(32) & Chr(34) & "AT&T Web Meeting" & Chr(34) & Chr(32) & Chr(34) & "Bluetooth Exchange Folder" & Chr(34) & Chr(32) & Chr(34) & "My PSP Files" & Chr(34) & Chr(32) & Chr(34) & "SAP" & Chr(34) & Chr(32) & Chr(34) & "TurboTax" & Chr(34) & Chr(32) & Chr(34) & "Temp" & Chr(34) & Chr(32) & Chr(34) & "Updater" & Chr(34) & Chr(32) & Chr(34) & "preboot" & Chr(34) & Chr(32) & Chr(34) & "COnfig.MSI" & Chr(34) & Chr(32) & Chr(34) & "NetHood" & Chr(34) & Chr(32) & Chr(34) & "NetworkService" & Chr(34) & Chr(32) & Chr(34) & "System Volume Information" & Chr(34) & Chr(32) & Chr(34) & "MSOCache" & Chr(34) & Chr(32) & Chr(34) & "Outlook" & Chr(34) & Chr(32) & Chr(34) & "Local Settings" & Chr(34) & Chr(32) & Chr(34) & "itunes" & Chr(34) & Chr(32) & Chr(34) & "i386" & Chr(34) & Chr(32) & Chr(34) & "amd64" & Chr(34) & Chr(32) & Chr(34) & "minint" & Chr(34) & Chr(32) & Chr(34) & "rrbackups" & Chr(34)
objExcludeDir = "/XD" & ExcludeDir

ExcludeFile = Chr(32) & Chr(34) & "*.ldr" & Chr(34) & Chr(32) & Chr(34) & "*.cfg" & Chr(34) & Chr(32) & Chr(34) & "*.dat" & Chr(34) & Chr(32) & Chr(34) & "*.BAT" & Chr(34) & Chr(32) & Chr(34) & "*.log" & Chr(34) & Chr(32) & Chr(34) & "*.SYS" & Chr(34) & Chr(32) & Chr(34) & "*.COM" & Chr(34) & Chr(32) & Chr(34) & "*.dmp" & Chr(34) & Chr(32) & Chr(34) & "*.ini" & Chr(34) & Chr(32) & Chr(34) & "*.dll" & Chr(34) & Chr(32) & Chr(34) & "*.pol" & Chr(34) & Chr(32) & Chr(34) & "*.exe" & Chr(34) & Chr(32) & Chr(34) & "*.mp3" & Chr(34) & Chr(32) & Chr(34) & "*.mp4" & Chr(34) & Chr(32) & Chr(34) & "*.mpg" & Chr(34) & Chr(32) & Chr(34) & "*.mpeg" & Chr(34) & Chr(32) & Chr(34) & "*.lnk" & Chr(34) & Chr(32) & Chr(34) & "*.abi" & Chr(34) & Chr(32) & Chr(34) & "*.adi" & Chr(34) & Chr(32) & Chr(34) & "*.abs" & Chr(34) & Chr(32) & Chr(34) & "*.adm" & Chr(34) & Chr(32) & Chr(34) & "*.accdb" & Chr(34) & Chr(32) & Chr(34) & "*.accdc" & Chr(34) & Chr(32) & Chr(34) & "*.accde" & Chr(34) & Chr(32) & Chr(34) & "*.accdr" & Chr(34) & Chr(32) & Chr(34) & "*.accdt" & Chr(34) & Chr(32) & Chr(34) & "*.accdu" & Chr(34) & Chr(32) & Chr(34) & "*.accdw" & Chr(34) & Chr(32) & Chr(34) & "*.accft" & Chr(34) & Chr(32) & Chr(34) & "*.log" & Chr(34) & Chr(32) & Chr(34) & "*.mav" & Chr(34) & Chr(32) & Chr(34) & "*.mdb" & Chr(34) & Chr(32) & Chr(34) & "*.mdbx" & Chr(34) & Chr(32) & Chr(34) & "*.mde" & Chr(34) & Chr(32) & Chr(34) & "*.mdf" & Chr(34) & Chr(32) & Chr(34) & "*.mdt" & Chr(34) & Chr(32) & Chr(34) & "*.mdx" & Chr(34) & Chr(32) & Chr(34) & "*.odb" & Chr(34) & Chr(32) & Chr(34) & "*.oedb" & Chr(34) & Chr(32) & Chr(34) & "*.db" & Chr(34) & Chr(32) & Chr(34) & "*.trc" & Chr(34) & Chr(32) & Chr(34) & "*.thmx" & Chr(34) & Chr(32) & Chr(34) & "*.odc" & Chr(34) & Chr(32) & Chr(34) & "*.bbb" & Chr(34) & Chr(32) & Chr(34) & "*.nsf" & Chr(34) & Chr(32) & Chr(34) & "*.ntf" & Chr(34) & Chr(32) & Chr(34) & "*.nbf" & Chr(34) & Chr(32) & Chr(34) & "*.id" & Chr(34) & Chr(32) & Chr(34) & "*.gif" & Chr(34) & Chr(32) & Chr(34) & "*.mdm" & Chr(34) & Chr(32) & Chr(34) & "*.dsk" & Chr(34) & Chr(32) & Chr(34) & "*.ncf" & Chr(34) & Chr(32) & Chr(34) & "*.med" & Chr(34) & Chr(32) & Chr(34) & "*.dic" & Chr(34) & Chr(32) & Chr(34) & "*.pst" & Chr(34) & Chr(32) & Chr(34) & "*.ost" & Chr(34) & Chr(32) & Chr(34) & "*.cnf" & Chr(34) & Chr(32) & Chr(34) & "*.ndk" & Chr(34) & Chr(32) & Chr(34) & "*.rnd" & Chr(34) & Chr(32) & Chr(34) & "*.hst" & Chr(34) & Chr(32) & Chr(34) & "*.njf" & Chr(34) & Chr(32) & Chr(34) & "*.box" & Chr(34) & Chr(32) & Chr(34) & "*.adr" & Chr(34) & Chr(32) & Chr(34) & "*.tab" & Chr(34) & Chr(32) & Chr(34) & "*.idt" & Chr(34) & Chr(32) & Chr(34) & "*.scr" & Chr(34) & Chr(32) & Chr(34) & "*.mov" & Chr(34) & Chr(32) & Chr(34) & "*.wmv" & Chr(34) & Chr(32) & Chr(34) & "*.dbf" & Chr(34) & Chr(32) & Chr(34) & "*.reg" & Chr(34) & Chr(32) & Chr(34) & "*.vcs" & Chr(34) & Chr(32) & Chr(34) & "*.mpp" & Chr(34) & Chr(32) & Chr(34) & "*.rdp"& Chr(34) & Chr(32) & Chr(34) & "*.htc" & Chr(34) & Chr(32) & Chr(34) & "*.ico" & Chr(34) & Chr(32) & Chr(34) & "*.inf" & Chr(34) & Chr(32) & Chr(34) & "*.cat" & Chr(34) & Chr(32) & Chr(34) & "*.emf" & Chr(34) & Chr(32) & Chr(34) & "*.dmg" & Chr(34) & Chr(32) & Chr(34) & "*.loc" & Chr(34) & Chr(32) & Chr(34) & "*.vbs" & Chr(34) & Chr(32) & Chr(34) & "*.xsd" & Chr(34) & Chr(32) & Chr(34) & "*.nfo" & Chr(34) & Chr(32) & Chr(34) & "*.bin" & Chr(34) & Chr(32) & Chr(34) & "*.xsl" & Chr(34) & Chr(32) & Chr(34) & "*.one" & Chr(34) & Chr(32) & Chr(34) & "*.out" & Chr(34) & Chr(32) & Chr(34) & "*.gp_" & Chr(34) & Chr(32) & Chr(34) & "*.gpd" & Chr(34) & Chr(32) & Chr(34) & "*.icm" & Chr(34) & Chr(32) & Chr(34) & "*.hl_" & Chr(34) & Chr(32) & Chr(34) & "*.dl_" & Chr(34) & Chr(32) & Chr(34) & "*.img" & Chr(34) & Chr(32) & Chr(34) & "*.azw" & Chr(34) & Chr(32) & Chr(34) & "*.mbp" & Chr(34) & Chr(32) & Chr(34) & "*.lpr" & Chr(34) & Chr(32) & Chr(34) & "*.phl" & Chr(34) & Chr(32) & Chr(34) & "*.wav" & Chr(34)
objExcludeFile = "/XF" & ExcludeFile

objage1 = "/MAXAGE:" & objdate1

objage2 = "/MINAGE:" & objdate2

objlogpath = "/log:" & objlogpath

objCommand = objcmd & Chr(32) & objSource & Chr(32) & objDestination & Chr(32) & objswitches & Chr(32) & objExcludeDir & Chr(32) & objExcludeFile & Chr(32) & objage1 & Chr(32) & objage2 & Chr(32) & objlogpath

Wscript.echo objcmd & Chr(32) & objSource & Chr(32) & objDestination & Chr(32) & objswitches & Chr(32) & objlogpath & Chr(32) & objage1 & Chr(32) & objage2

objShell.Run(objCommand)

*********


below is my updated non working script

Set objShell = CreateObject("Wscript.Shell")

inputFile = ".\list.txt"

Const conForReading = 1
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")Set oShell=WScript.CreateObject("WScript.Shell")

Set oInputFile = objFSO.OpenTextFile(inputFile, conForReading)

Do Until oInputFile.AtEndOfStream
arrstrFiles = oInputFile.ReadAll
Loop

arrFiles = Split(arrstrFiles, vbCrLf)

strFiles = ""

For i=0 to Ubound(arrFiles)
strFiles = strFiles & " " & arrFiles(i)
Next

objSource = InputBox("Please enter the Path to the source Data: Example: C:\Source\Data", _
"Source Folder")
If objSource = "" Then
Wscript.Quit
Else
Wscript.Echo objSource
End If

objDestination = InputBox("Please enter the Path to Destination Folder: Example: C:\Target\Data", _
"Destination Folder")
If objDestination = "" Then
Wscript.Quit
Else
Wscript.Echo objDestination
End If

objdate1 = InputBox("Only get files Newer than yyyymmdd:" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Example: 20121126", _
"Files Newer Than Date")
If objdate1 = "" Then
Wscript.Quit
Else
Wscript.Echo objdate1
End If

objdate2 = InputBox("Only get files Older than yyyymmdd:" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Example: 20121126", _
"Files Older Than Date")
If objdate2 = "" Then
Wscript.Quit
Else
Wscript.Echo objdate2
End If

objlogpath = InputBox("Please enter the Path and name of the existing log folder: Example: C:\LogFolder\logname.txt" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "LOG FILE MUST HAVE A .TXT EXTENSION", _
"Log Path and Folder Folder")
If objlogpath = "" Then
Wscript.Quit
Else
Wscript.Echo objlogpath
End If

objcmd = "Robocopy"
objSource = """" & objSource & """"
objDestination = """" & objDestination & """"
objdate1 = "" & objdate1 & ""
objdate2 = "" & objdate2 & ""
objswitches = " /B /E /A-:SH /COPYATO /R:2 /W:5 /V /TEE /XJ "

objage1 = "/MAXAGE:" & objdate1

objage2 = "/MINAGE:" & objdate2

objlogpath = "/log:" & objlogpath

objCommand = objcmd & Chr(32) & objSource & Chr(32) & objDestination & Chr(32) & objswitches & Chr(32) & strFiles & Chr(32) & objage1 & Chr(32) & objage2 & Chr(32) & objlogpath

Wscript.echo objcmd & Chr(32) & objSource & Chr(32) & objDestination & Chr(32) & objswitches & Chr(32) & objlogpath & Chr(32) & objage1 & Chr(32) & objage2

objShell.Run(objCommand)


I would really appreciate it if someone can help me out if its not too much trouble