|||
Mike Tomkies wrote:
Yes i do mean the file system task in ssis. It has an option to delete directory content that deletes subdirevtory content as well. I just want to delete the files in the directory and not the sub directory. Can this task do this or do i have to revert to writing script using the File System Object to do this?
Use a foreach loop to spin through the directory of your choosing. This will allow you to use a wildcard to get at the files you are specifically interested in deleting (even if it's *.*). Then inside the foreach loop, use a File System Task set to "Delete File". Pass in the file name from the foreach loop and you should be set.|||This for each loo how will it read the file names to pass to the task to delete?|||
Mike Tomkies wrote:
This for each loo how will it read the file names to pass to the task to delete?
It's built to do that. Click on the Collection tab and the enumerator should be set to "Foreach File Enumerator". From here, just give it a base directory and let it go to work.|||Thanks that is what i need.|||Think it would of been easy if The File system Task had the Traverse SubFolders option as in the ForEachLoop Container.
No comments:
Post a Comment