epicazo
asked on
Error running VBS
I am trying to copy files to FolderA then move them to FolderB, but I get an VBScript error:
LINE 11
CHAR: 9
ERROR: Bad File name or number
Code 800A0034
See CODE BELOW...
LINE 11
CHAR: 9
ERROR: Bad File name or number
Code 800A0034
See CODE BELOW...
strSourceFolder = "\\10.41.40.119\ercharts$"
strTargetFolderA = "\\10.41.40.119\ercharts$"
strTargetFolderB = "\\10.41.32.139\rootsftp$\MarinaMBS"
If Right(strSourceFolder, 1) <> "\" Then strSourceFolder = strSourceFolder & "\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set objSource = fso.GetFolder(strSourceFolder)
For Each oFile In objSource.Files
strFirst8 = Left(oFile.Name, 8)
If Not fso.FolderExists(strTargetFolderA & strFirst8) Then
fso.CreateFolder strTargetFolderA & strFirst8
End If
fso.copyfile strSourceFolder & oFile.Name, strTargetFolderA & strFirst8 & "\"
fso.MoveFile strSourceFolder & oFile.Name, strTargetFolderB & strFirst8 & "\"
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
msgbox strTargetFolderA & strFirst8