I will give you an outline of how to achieve this
DECLARE @InsertedRecords INT
CREATE TABLE #GetFileList
(
SrNo Int IDENTITY (1,1),
FileListOutPut Varchar(1000)
)
INSERT INTO #GetFileList (FileListOutPut)
EXEC master.dbo.xp_cmdshell 'DIR \\ \*.bak /OD /-C /B'
-- /OD...