troubleshooting Question

"Expected end of statement" error in VBScript code.

Avatar of donnie91910
donnie91910 asked on
VB Script
3 Comments1 Solution86 ViewsLast Modified:
I have written VBScript code to look for specific files in a folder and when the code finds the files the code will move the files to another folder.  I am able to find one file and move it, but when I try to find two or more files I get the "Expected end of statement" error.  I have included the code that I have written.  

Dim objFSO
Dim sSourceFolder
Dim sDestFolder
Dim sDBFile
Dim sDateTimeStamp
'Const OVER_WRITE_FILES = False
Set objFSO = CreateObject("Scripting.FileSystemObject")
sSourceFolder = "C:\Oceanside\"
sBackupFolder = "C:\Files_Found\"
sDBFile = "ROWP19-0578 PERMIT","ROWP19-0579 PERMIT"  'Expected end of statement error on this line when I try to search for two files
sDBFileExt = "pdf"
 
'If the backup folder doesn't exist, create it.
If Not objFSO.FolderExists(sBackupFolder) Then
    objFSO.CreateFolder(sBackupFolder)
End If
 
'Copy the file as long as the file can be found
If objFSO.FileExists(sSourceFolder & "\" & sDBFile & "." & sDBFileExt) Then
    objFSO.CopyFile sSourceFolder & "\" & sDBFile & "." & sDBFileExt,_
			sBackupFolder & "\" & sDBFile & "." & sDBFileExt
MsgBox sSourceFolder & " was copied to " & sBackupFolder
End if
 
Set objFSO = Nothing
Any help is greatly appreciated.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros