Quantcast
Viewing all articles
Browse latest Browse all 15889

How to delete the Folder from sql server 2008

Hi all,

I was trying to delete the folder from sql server 2008 with the below script

DECLARE @path VARCHAR(256) -- path for backup files

DECLARE @cmd VARCHAR(8000)

DECLARE @folderName VARCHAR(256) -- filename for backup


SET @folderName = + (CONVERT(varchar(10), GETDATE()-7, 112))  -- 7 days back date folder name
SET @path = 'I:\Backup_Test\' + @folderName -- Folder path
SET @cmd = 'del ' + @path -- Delete

EXEC master..xp_cmdshell @cmd

--Print @cmd

 

 

This is not working it was asking the Confirmation (I:\Backup_Test\20100629\*, Are you sure (Y/N)? ) what will i do to the delete the folder.

Thanks,

Prasad R.

 


Viewing all articles
Browse latest Browse all 15889

Trending Articles