Exec master.dbo.xp_cmdshell 'rename C:\OldFileName.* NewFileName.*'
Exec master.dbo.xp_cmdshell 'rename C:\MasterFolderName MasterFolderNewName'
DECLARE @MasterFolder VARCHAR(15)
DECLARE @query NVARCHAR(MAX)
SET @MasterFolder = 'MasterFolder'
SET @query = 'exec master.dbo.xp_cmdshell ''rename C:\' + @MasterFolder
+ '\SubFolderName SubFolderNewName'''
PRINT @query
EXEC sp_executesql @query
Exec master.dbo.xp_cmdshell 'rename C:\MasterFolderName MasterFolderNewName'
DECLARE @MasterFolder VARCHAR(15)
DECLARE @query NVARCHAR(MAX)
SET @MasterFolder = 'MasterFolder'
SET @query = 'exec master.dbo.xp_cmdshell ''rename C:\' + @MasterFolder
+ '\SubFolderName SubFolderNewName'''
PRINT @query
EXEC sp_executesql @query
0 Comments