How can I modify the for each loop to go through all the folders under parent folder?
ParentFolder
SubFolder1
SubFolder2
SubFolder3
Maybe add another foreach loop?|||Click the transverse subfolders checkbox?|||
Crispin wrote:
Click the transverse subfolders checkbox?
Yes. Using the Foreach File Enumerator, you have this option.... That should work for the OP.|||Transverse Subfolders is the way to go. Just make sure you specify the parent folder in the foreach loop|||
I actually tried that already and it does not give me the result I need. If there are no files present in the sub folder nothing happens.
ParentFolder
SubFolder1
SubFolder2
SubFolder3
What I am trying to do is delete all subfolders over 90 days old in the parent folder but first I want to write the folder name to a txt file/email/db which ever is decided later on.
The thing is, the name of the subfolders can change and the subfolder may not always contain a file. It maybe empty sometimes. When I use Traverse subfolders it looks in the subfolders for files. If there are files in those subfolders the package works fine. But when no files are present nothing happens.
|||If there are no files in any of the folders, then it will return nothing as it's a File Enumerator.The only way would be to have a script task beforehand and check the folders there. If they are empty, delete them.
Have a look for VB.net examples on google for listing directories.|||One of the SSIS custom component samples Microsoft provides is a Directory enumerator. I'd take a look at that for this purpose.
No comments:
Post a Comment