So there is an 'F' in way
One of the things I do to help ensure I don't have any free time is working as a technical reviewer for computer books. I typically move from one to another and I tend to stay pretty busy. Anyway, I recently started a new project and the delivery method is FTP. To make a long story short, I decided to write a SSIS package to pull down and deliver updates documents. "But Bill, you can do this in .NET without SSIS so why go through all that trouble?" Mainly because SSIS is cool and I haven't gotten to use it in a few months.
Well, I whipped out the package without a problem. However as more files started to accumulate, I ran into a problem. I usually didn't know when a new file was added. Until that point, I was either hard coding or using a variable for the Remote Path property of the task. So for instance, I was setting the file name for the Remote Path at each pass, like so:
- /Richard Fanin/Richard1.docx
- /Randall Flagg/Randall1.docx
- /Mark Brown/Mark1.docx
As the number of files grew and grew, I just decided to pull down the whole folder. The problem was that when I tried to just specify a directory without file names, the FTP server told me that the files were no longer directly accessible and could only be found behind the letter "F" in the word "Way"
Any time something seems this lame or limited, it's almost never the product, it's your lack of understanding of it. So I moved on trying about every trick I could think of. My last one was using a For Each loop and getting file names from it. But that was just stupid, after all, my goal was to find *new* files not ones I already knew about.
After diggging around a little I tried trick after trick. Then a little voice in my head said "Wildcards are supported all over the place in SSIS, why not try them?" So I did. And 5 minutes later, I was pulling down all the .docx files in the directory. Yep, it was as easy as using "*.*" (or whatever other search pattern applied) but that was it.
So the same won't work in reverse, or at least as far as I can tell at the moment. However going the other way, you know the filename already (think For Each loop) so it's a non issue addressed by just using the loop and a variable.
I'm not entirely sure something this simple is worthy of a blog post, however I did spend about 20 minutes trying to figure it out and hopefully it'll save someone else some time in the future.