I have an agent which transfers files between servers.When I ran the agent manually, working fine.When I schedule it I am getting an error: “Illegal function call”
My code goes like this:
Sub Tranportfiles
'Unix side handling to transfer the file to windows directory(C:\Lotus)
Dim GetFileName As String
Dim FileDirPath As String
Dim FName As String
Dim UnCpath As String
'******Copy files from Unix to Windows *****
'Get File name path unix side
GetFileName$="\\ims4\ims4_usr2\lotusshare\sree\*.txt" 'Used to get actual file name in unix folder
FileDirPath$="\\ims4\ims4_usr2\lotusshare\sree\" 'Set the file directory path
FName$=Dir$(GetFileName$,0) 'Get the File name
UnCpath$=FileDirPath$ & Fname$
'Setting up of the file paths windows side
IMPortFilepath$="C:\Lotus\*.txt"
Path$="C:\Lotus\" 'Path of the directory.
CPath$=Path$ & FName$
'Loop through to move all the text file and kills the text files in unix side
Do While FName$ <>""
CPath$=Path$ & FName$
Filecopy UnCpath$,CPath$
Kill UnCpath$
FName$=Dir$(GetFileName$,0)
UnCpath$=FileDirPath$ & FName$
Loop
'************Moving the files over *************
End Sub '** End of Tranport sub routene**
I think FName$=Dir$(GetFileName$,0) is causing that error when I ran as a scheduled agent?
Am I doing any thing wrong…
Any help appreciated.
Regards,
Sree