DECLARE @ToDirectory VARCHAR(500)
SET @ToDirectory ="C:\FolderName"
DECLARE @FromDirectory VARCHAR(500)
SET @FromDirectory = "D:\"
DECLARE @CopyFromToQuery VARCHAR(500)
SET @CopyFromToQuery ='robocopy '+@FromDirectory + ' ' + @ToDirectory + ' /E /MOVE'
PRINT @CopyFromToQuery
EXEC master..xp_cmdshell @CopyFromToQuery
SET @ToDirectory ="C:\FolderName"
DECLARE @FromDirectory VARCHAR(500)
SET @FromDirectory = "D:\"
DECLARE @CopyFromToQuery VARCHAR(500)
SET @CopyFromToQuery ='robocopy '+@FromDirectory + ' ' + @ToDirectory + ' /E /MOVE'
PRINT @CopyFromToQuery
EXEC master..xp_cmdshell @CopyFromToQuery
0 Comments