What account is the SQL Server Agent Service running as? Is it running as localsystem? Is it running as a local user eg. Computername\SqlAgentUser? Is running as a domain user eg. Domain\SqlAgentUser?
Local System has no ability to see any resources outside the local computer.
A Local user can only see resources on other computers if there happens to be a local user on that computer with the same name and the same password, and has the appropriate permissions.
A Domain user can see resources on any domain member where he has permissions.
If it is not a domain user then that is the first problem. If it is a domain user then I suggest the following:
Logon to your sql server as the user account that runs the SQL Server Agent Service. Then goto the \\SERVERNAME\DIRECTORY\docs\xml directory and then create a file there. If this is successful then you should have no problems running the job.
If not successful then try and access the \\SERVERNAME\DIRECTORY this will ensure that you at least have read permissions to the share named DIRECTORY. You can check the permissions of the Share using Computer Manager, connecting to the SERVERNAME computer and then clicking on Shared Folders, and then clicking on Shares. Then right click on the share called DIRECTORY and select properties. Then you can look and see if the permissions at the share level allow the SQLAgentUser write (Must be Change or Full Control).
Then navigate to \\SERVERNAME\DIRECTORY\docs\ directory right click on the xml directory and select Properties. Go to the Security Tab and ensure that the NTFS permission permit the SQLAgentUser the ability to write and delete files.
Principal Consultant and Trainer