I have some vbscript for copying a file - it works fine when I double-click it. However, if I try to put it under control of the Scheduled Tasks (in Windows 2000) - the task runs indefinitely (and is never successful).
I've tried recoding the vbscript (as a shell call and using .CopyFile). Same result.
I guess the issue is with the Scheduler...anyone seen this before, know a solution?
Thanks.
'path is the path to the builds
path ="\\dragon\Releases\2.3SP1"
Set oFSO = CreateObject("scripting.filesystemobject")
location = oFSO.GetAbsolutePathName(path)
Deploy_from(location)
Function Deploy_from(s)
Dim aDate
Dim aName
Dim oFldr,oSubFldr
Dim cFldr
Dim iCnt
Dim n,m,temp
Set oFldr = oFso.GetFolder(s)
Set cFldr = oFldr.SubFolders
'ReDim array to number of folders
ReDim aDate(oFldr.SubFolders.Count)
iCnt = 1
'Add date creation (and only for the client folders)
For Each oSubFldr in cFldr
aDate(iCnt) = oSubFldr.Datecreated
iCnt = iCnt + 1
Next
'Sorting array by date, ascending sort order
For n = 0 to UBound(aDate) -1
For m = n+1 to UBound(aDate)
If aDate(m) < aDate
Then
temp = aDate(m)
aDate(m) = aDate
aDate
= temp
End If
Next
Next
MaxDate = aDate(iCnt-1)
For Each oSubFldr in cFldr
If oSubFldr.Datecreated = MaxDate then
MaxName = oSubFldr.name
end if
Next
'now we have the directory most recently created
'we can use that ear file and deploy it
'Msgbox Maxname &" "& MaxDate
Set objFSO = CreateObject("scripting.filesystemobject")
'copy the new ear
sToCopyFrom = "\\dragon\Releases\2.3SP1\"& Maxname & "\WebConnect.ear"
sToCopyTo = "C:\bea\user_projects\domains\WebConnect\myserver\upload\"
objFSO.CopyFile sToCopyFrom , sToCopyTo, True
End Function
I've tried recoding the vbscript (as a shell call and using .CopyFile). Same result.
I guess the issue is with the Scheduler...anyone seen this before, know a solution?
Thanks.
'path is the path to the builds
path ="\\dragon\Releases\2.3SP1"
Set oFSO = CreateObject("scripting.filesystemobject")
location = oFSO.GetAbsolutePathName(path)
Deploy_from(location)
Function Deploy_from(s)
Dim aDate
Dim aName
Dim oFldr,oSubFldr
Dim cFldr
Dim iCnt
Dim n,m,temp
Set oFldr = oFso.GetFolder(s)
Set cFldr = oFldr.SubFolders
'ReDim array to number of folders
ReDim aDate(oFldr.SubFolders.Count)
iCnt = 1
'Add date creation (and only for the client folders)
For Each oSubFldr in cFldr
aDate(iCnt) = oSubFldr.Datecreated
iCnt = iCnt + 1
Next
'Sorting array by date, ascending sort order
For n = 0 to UBound(aDate) -1
For m = n+1 to UBound(aDate)
If aDate(m) < aDate
temp = aDate(m)
aDate(m) = aDate
aDate
End If
Next
Next
MaxDate = aDate(iCnt-1)
For Each oSubFldr in cFldr
If oSubFldr.Datecreated = MaxDate then
MaxName = oSubFldr.name
end if
Next
'now we have the directory most recently created
'we can use that ear file and deploy it
'Msgbox Maxname &" "& MaxDate
Set objFSO = CreateObject("scripting.filesystemobject")
'copy the new ear
sToCopyFrom = "\\dragon\Releases\2.3SP1\"& Maxname & "\WebConnect.ear"
sToCopyTo = "C:\bea\user_projects\domains\WebConnect\myserver\upload\"
objFSO.CopyFile sToCopyFrom , sToCopyTo, True
End Function