VB Script will not run on Windows 2008

I have these 2 script that I use to add and remove files daily from a file share.  For some reason this scripts will not run on Windows 2008.  Any thoughts??

Removal script below, and copy files script attached...

Dim sFolderPath : sFolderPath = "\\server\share" 'set folder path here
Dim oFso: Set oFso = CreateObject("Scripting.FileSystemObject")
Dim oFolder : Set oFolder = oFso.GetFolder(sFolderPath)
Dim cFiles : Set cFiles = oFolder.Files
For Each ofile In cFiles
        oFso.DeleteFile ofile.path
Next
strComputer = "."
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim SizeCount
 
Const ForAppending = 8
Const ForWriting = 2
Const ForReading = 1
 
WorkingDate = Date
DateFormated = Replace(WorkingDate,"/","-")
DateSplit = Split(DateFormated,"-")
 
DateMonth = DateSplit(0)
DateDay = DateSplit(1)
DateYear = DateSplit(2)
 
DateFinal = DateMonth & "-" & DateDay & "-" & DateYear
 
Yesterday = Date - 1
YesterdayFormated = Replace(Yesterday,"/","-")
'WScript.Echo YesterdayFormated
YesterdaySplit = Split(YesterdayFormated,"-")
 
YesterdayMonth = YesterdaySplit(0)
YesterdayDay = YesterdaySplit(1)
YesterdayYear = YesterdaySplit(2)
 
YesterdayFinal = YesterdayMonth & "-" & YesterdayDay & "-" & YesterdayYear
'WScript.Echo "yesterday = " & YesterdayFinal
 
 
'WScript.Echo "Today's Date: " & datefinal
 
 
objStartFolder = "\\server\share"
objDestinationFolder = "\\server\share1"
 
Set objFolder = objFSO.GetFolder(objStartFolder)
Wscript.Echo objFolder.Path
Set colFiles = objFolder.Files
For Each objFile in colFiles
    'Wscript.Echo objFile.Name
    If objFile.Name = "Daily Report " & DateFinal & ".pdf" Then
    	'WScript.Echo "file found"
    	'WScript.Echo objStartFolder & "\" & objFile.Name,objDestinationFolder & "\" & objFile.Name,True
    	objfso.CopyFile objStartFolder & "\" & objFile.Name,objDestinationFolder & "\" & objFile.Name,True
    	If objfso.FileExists (objDestinationFolder & "\CRS Daily Report " & YesterdayFinal & ".pdf") Then
    		'WScript.Echo "old file found"
   			objfso.DeleteFile objDestinationFolder & "\Daily Report " & YesterdayFinal & ".pdf"
   		End If
    End If
Next
 
ShowSubfolders objFSO.GetFolder(objStartFolder)
 
Sub ShowSubFolders(Folder)
    For Each Subfolder in Folder.SubFolders
        'Wscript.Echo Subfolder.Path
        Set objFolder = objFSO.GetFolder(Subfolder.Path)
        Set colFiles = objFolder.Files
        For Each objFile in colFiles
		    'Wscript.Echo objFile.Name
		    If objFile.Name = "Daily Report " & DateFinal & ".pdf" Then
		    'WScript.Echo "file found"
		    	objfso.CopyFile Subfolder.Path & "\" & objFile.Name,objDestinationFolder & "\" & objFile.Name,True
		    	If objfso.FileExists (objDestinationFolder & "\Daily Report " & YesterdayFinal & ".pdf") Then
		    		objfso.DeleteFile objDestinationFolder & "\Daily Report " & YesterdayFinal & ".pdf"
		   		End If
		    End If
        Next
        'Wscript.Echo
        ShowSubFolders Subfolder
    Next
End Sub

Open in new window

LVL 4
seaninmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
What happens when you run it, do you get any errors, etc?

~bp
0
seaninmanAuthor Commented:
says cant find path... but when i run it on an XP machine works perfectly
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
seaninmanAuthor Commented:
No other solutions provided.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.