title: Rename list of files from SQL Server 2012
body: <p>I have a table which has 1000+ records with file name, file path and new file name. I want to rename existing files from FileName to NewFileName. Is there any possibility to rename these files from SQL Server 2012.</p>
  
  <p><a href="https://i.stack.imgur.com/4ZdYs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4ZdYs.jpg" alt="enter image description here"></a></p>
  
  <p>I am able to do this for one file but I have a problem with doing this for multiple files.</p>
  
  <pre><code>DECLARE @cmd varchar(1000)
  SET @cmd = 'rename C:\Test\A.txt A_new.txt'
  EXEC master..xp_cmdshell @cmd 
  </code></pre>