Delete a file running a SQL Agent job - What a complication - Possible?

  • Hello:

    Something so simple to do manually "delete c:\Temp\MyFile.txt", I can not set to run in a SQL Server 2008 Job!!!!!!!!!!!!!!

    I tried many things, like create a Store Procedure, could not make it work.

    Also get the famous "xp_cmdshell" configuration set to 1.

    Why Microsoft had to complicate things? Maybe get a better scheduler in the OS Windows will help? because the Task scheduler is not very reliable.

    Just fustrated.... any help will be appreciated.

    Thanks

    Pablo

  • Setup the job step type as an Operating system (CmdExec) and use something like ForFiles to delete the files...i.e.

    Forfiles -p "c:\Temp" -s -m *.txt -d -1 -c "Cmd /C del @FILE

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply