Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

delete old SSIS log files using maintenance plan Expand / Collapse
Author
Message
Posted Wednesday, July 24, 2013 12:21 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, August 29, 2014 3:18 PM
Points: 1,773, Visits: 3,207
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
Post #1477197
Posted Thursday, July 25, 2013 1:45 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 12:02 PM
Points: 13,638, Visits: 10,530
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?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1477369
Posted Thursday, July 25, 2013 1:55 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:07 AM
Points: 5,339, Visits: 9,794
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
Post #1477375
Posted Thursday, July 25, 2013 10:23 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 22, 2014 12:24 PM
Points: 2,829, Visits: 8,477
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.



Post #1477612
Posted Thursday, July 25, 2013 10:28 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, August 29, 2014 3:18 PM
Points: 1,773, Visits: 3,207
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,
Post #1477618
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse