I was trying your options by using "(operating system) cmdExec" to delete folders which were 15 days olders. But here i am getting error if i look into view history of sql agent job... below is my command that i gave in Job step.
EXEC xp_cmdshell 'forfiles /p "z:\backup" -d 15 /c "cmd /c if @isDir==True echo RD /Q /S @FILE&RD /Q /S @FILE"'
And the error is :
The process could not be created for step 1 of job .....(reason: The system cannot find the file specified). The Step failed.
but if i give this command in New Query Window, i am able to delete the folders successfully.
Please advice me if am wrong
View Complete Post