Execute complex filesystem operations with the Script task
In the previous recipe, you retrieved filenames filtered by name and extension using the Foreach File enumerator of the Foreach Loop container. Sometimes you need more precise filters. For example, you might need to retrieve files with a larger size than a predefined value. You can get the collection of the filenames that satisfy your custom criteria with the Script task.
Getting ready
There are no special prerequisites for this recipe, except, of course, SSIS 2016. In addition, you can use either your own text files for testing, or the three text files provided with the code for this chapter (Ch07_03.txt
, Ch07_08.txt
, and Ch07_10.txt
). Note that the length of the Ch07_03.txt
file is 3 bytes, the Ch07_08.txt
file is 8 bytes, and the Ch07_10.txt
file is 10 bytes.
How to do it...
- In
File Explorer
, right-click theCh07_08.txt
file and selectProperties
, as shown in the following screenshot:
- Note the file size, 8 bytes. Click
OK
. - In SSDT...