Quantcast
Channel: Questions in topic: "sql-agent"
Viewing all articles
Browse latest Browse all 80

I need to delete a file from one particular path.

$
0
0
Hi, My job is automate the trace for our customer. so, i will start the trace automatically through a schedule job. This job will save a trace in the particular path Eg: C:\Trace\Full_Performance_Trace_Mon.TRC Note: Here the path is C:\Trace, Trace will automatically create the file names like Full_Performance_Trace_Mon , Full_Performance_Trace_Tue, Full_Performance_Trace_Wed... on with respect to the today's day. Now, My problem is say now I'm running the trace the new file Full_Performance_Trace_Tue will get saved today. Now, if i again run the trace the job comes with the error message stating that the file is already available. So, i need to write a query through CMD shell if a file is already available in the location go if it is on today's day then the new file should incremented to Full_Performance_Trace_TUE1 else i need to delete the file.. for deleting the file i can use this [exec sp_trace_create @TraceID output, 0, @filepath, @maxfilesize, @stoptime] But, i need a condition for deleting a file. Thanks for the help any question let me know. Thanks Satish

Viewing all articles
Browse latest Browse all 80

Latest Images

Trending Articles



Latest Images