Thursday, 1 October 2015

Using xp_cmdshell to rename Files,Folder and Sub Folder using Sql

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

No comments:

Post a Comment

Row based styling for Primeng DataTable using Angualr 2,4

------------------------------------Component.Html---------------- < p -dataTable id = "Tbl" [ rowStyleClass ]= " Fu...