IF OBJECT_ID('tempdb..#TempTableName') IS NOT NULL
DROP TABLE #TempTableName ;
CREATE TABLE #TempTableName
(
id INT IDENTITY(1, 1) ,
subdirectory NVARCHAR(512) ,
depth INT
) ;
INSERT #TempTableName
( subdirectory
)
EXEC MASTER.dbo.xp_cmdshell 'dir DriveName:\ /b /o:n /ad'
IF NOT EXISTS ( SELECT 1
FROM #TempTableName )
BEGIN
EXEC XP_CMDSHELL 'net use DriveName: \\ServerName\DriveName /user:domain\USERNAME PASSWORD'---code for Mapping drive in local Pc
END
DROP TABLE #TempTableName ;
CREATE TABLE #TempTableName
(
id INT IDENTITY(1, 1) ,
subdirectory NVARCHAR(512) ,
depth INT
) ;
INSERT #TempTableName
( subdirectory
)
EXEC MASTER.dbo.xp_cmdshell 'dir DriveName:\ /b /o:n /ad'
IF NOT EXISTS ( SELECT 1
FROM #TempTableName )
BEGIN
EXEC XP_CMDSHELL 'net use DriveName: \\ServerName\DriveName /user:domain\USERNAME PASSWORD'---code for Mapping drive in local Pc
END
0 Comments