Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

job to delete old files

$
0
0

 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


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>