July 24, 2013 at 12:21 pm
We have a SSIS log folder that has a lot of daily log files for SSIS packages.
I am hoping to use maintenance plan to delete the files.
So I chose the task of maintenace clean up task, and browse to the folder, and put the extension txt.
and select older than one hour to test.
But no files are deleted,
is it because this only applies to backup filea nd maintenance plan report file?
but look at the SQl it genreate:
it is :
EXECUTE master.dbo.xp_delete_file 1,N'D:\_SSISFILES\Log\' ,N'txt',N'2013-07-24T10:19:31',1
So I guess it should not matter what files are they, as log as it has an extension of txt.
But why it is not working?
THanks
July 25, 2013 at 1:45 am
You could also build an SSIS package to do this with the File System Task. (or with some .NET code)
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 25, 2013 at 10:23 am
I use microsoft utility FORFILES to delete old files and schedule it through SQL agent. I think the syntax varies depending on your version of Windows.
For me on Windows server 2003, this is one script I use to delete *.* files in a specific folder older than 180 days:
forfiles /p "i:\objectscripts" /s /m *.* /c "cmd /c del @path" /d -180
Quirk: The SQL job will show failed if there are no files to delete.
July 25, 2013 at 10:28 am
Thanks, all, you are right , I hope use that maintenance plan task as an easier way to do the clean up, now I got to know it doesn't work for all kinds files with extension, it not only looks at extension, but also the header of text.
I like the idea of using forfiles, I forgot I used that for a couple of our web servers IIS log cleanup, I will reuse that too.
Thanks,
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply