SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


delete old SSIS log files using maintenance plan


delete old SSIS log files using maintenance plan

Author
Message
sqlfriends
sqlfriends
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10666 Visits: 4207
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
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63712 Visits: 13298
You could also build an SSIS package to do this with the File System Task. (or with some .NET code)


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
John Mitchell-245523
John Mitchell-245523
SSC-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: General Forum Members
Points: 35291 Visits: 16683
Have a look at this. It seems that xp_delete_file goes into the file itself and checks the header. Looks like you may have to roll your own, as Koen suggests.

John
homebrew01
homebrew01
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12592 Visits: 9222
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.



sqlfriends
sqlfriends
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10666 Visits: 4207
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,
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search