I would like to create a sql agent job to run operating system cmd, as a step for a job.
I tried to delete the files with .txt extension in a log directory that is older than 5 days,
I tried below, but it is not working.
forfiles -p "C:\SSISFILES\Log\" -s -m *.txt -d -5 -c "cmd /q /c del C:\SSISFILES\Log\"
I don't know how I can put this to the command window in sql agent job type: Operating system(CmdExec)
Is this the right syntax, I tried but not working.
I don't want to use EXEC xp_cmdshell, but I can also open to a .bat file.
What is the syntax? Thanks.
SQLFriend