I'm using the following query to view files/folders in a given directory. It works locally, but when trying to view a mapped drive I get...
"The system cannot find the path specified."
I have the permissions for the whole mapped drive set to the service account associated with SQL, but it is still not working.
declare @files table (ID int IDENTITY, FileName varchar(100))
insert into @files execute xp_cmdshell 'dir Z:\ /b'
select * from @files
End goal is to create a stored procedure that will transact specific file names into a table.
\\Server\Share
) rather than a mapped drive. Drive mappings are specific the user/session.The network name cannot be found
NET VIEW \\server
from a command prompt?xp_cmdshell
.