May 1, 2007 at 4:06 pm
I'm trying to use SSIS to delete files older than a certain date in a directory. I cannot find anywhere on the 'net an idea of how to do this. I have looked at xp_delete_file and played around with it a bit, as logically I thought it could be adapted for non-backup files, however that seems to be limited to maintenance.
I have a process that dynamically appends the date to file names in SSIS, however once the files are older than 7 days, I want to clean up the directory. The appended date could be useful, if necessary, opposed to somehow reading the file properties for creation date.
I tried testing a "for each" loop which reads through a directory, and built a file system task inside with a delete file as that intuitively seems to be the proper method -- however I cannot limit the files pulled into the "for each" loop.
Any ideas would be appreciated.
Matt
May 1, 2007 at 4:37 pm
There's an article somewhere on this site called "Windows Utilities for the Database Administrator" or something to that effect which goes into the usage of FORFILES to do something like this. Good readin'.
May 2, 2007 at 10:18 am
Thanks for pointing me to the article. And, I can get it to work from the command line nicely, however when I save it to a ".bat" file, it does not work. Even from the same directory as the files I am cleaning up. I have dusted off my DOS book, but to no avail, so far.
Any ideas ...? Anyone ...?
May 17, 2007 at 9:32 am
I wound up getting the dos based solution to work.
Thanks all who looked.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply