system
November 9, 2012, 2:49pm
1
I’m trying to delete a file on the Windows job server (actually a network drive on it) using the following command:
exec('cmd.exe', 'del "G:\\BMJ Technology\\Business Objects DI\\TrgFiles\\CedAr\\JFS_batch_00104.xml"', 1);
But I get the error:
Function <exec> failed to execute program <cmd.exe del \"G:\BMJ Technology\Business Objects DI\TrgFiles\CedAr\JFS_batch_00104.xml\">. Program terminated with exit code <1>.
When I run the command from the command prompt it works:
del "G:\BMJ Technology\Business Objects DI\TrgFiles\CedAr\JFS_batch_00104.xml"
When I change the flag to 8 the job runs OK but the file is not deleted.
Thanks in advance.
George (BOB member since 2003-06-27)
system
November 9, 2012, 5:32pm
2
Can you try this and say what message it tells?
PRINT(exec('cmd.exe', 'del "G:\\BMJ Technology\\Business Objects DI\\TrgFiles\\CedAr\\JFS_batch_00104.xml"', 8));
ganeshxp (BOB member since 2008-07-17)
system
November 9, 2012, 5:37pm
3
Thanks for your reply. It gives the following:
The system cannot find the path specified.
I think it must be a permissions issue, so I tried it for a file on the job server C drive and it works.
Strange because DS does have access to that share.
George (BOB member since 2003-06-27)
system
November 9, 2012, 5:38pm
4
3 Questions:
You said G Drive is a drive on the Job Server…That is correct and holds true right?
Are you logging into the Job Server and accessing the Command Prompt and deleted that? Or from where?
The account with which you logged into Job Server, the same as the account that runs the service?
Anyrow, run the code I posted and that should give the message!
At last, is G Drive a map network Drive?
ganeshxp (BOB member since 2008-07-17)
system
November 9, 2012, 8:31pm
5
Usually mapped drives don’t exist on the Job Server O/S. They may exist on your desktop machine but that’s not where the job is running.
eganjp (BOB member since 2007-09-12)
system
November 12, 2012, 9:28am
6
3 Questions:
You said G Drive is a drive on the Job Server…That is correct and holds true right?
Are you logging into the Job Server and accessing the Command Prompt and deleted that? Or from where?
The account with which you logged into Job Server, the same as the account that runs the service?
Anyrow, run the code I posted and that should give the message!
At last, is G Drive a map network Drive?
Yes, G drive is a mapped network drive on both the job server and client. The jobs access it with \server name\share.…
Yes, when I tested it I logged onto the job server, into command prompt and ran the command which deleted the file.
It’s a different account, I logged in as that user and tried the same, it didn’t work, so that’s the problem.
Thanks for your help:-)
George (BOB member since 2003-06-27)