Introduction
This article teaches how to use the Advanced File System to copy files from a folder with a size of ‘x’ MB to a size of’ y’ MB.
We will use the ZS Advanced File System task to detect the files between 5 to 20 MB.
Then, we will copy the files from that list.
Prerequisites
- SSIS PowerPack: Download and install the ZappySys SSIS PowerPack from the Customer Download Area or get the trial version.
Steps
Method 1: Using Foreach Loop Container
- Drag and drop an Advanced File System Task with the following configuration:
- Select the option Get file list as ADO.net Data Table.
- Choose a folder and a variable to save the result.
-
Go to the Filter and Sorting tab and use the expression
Size > 5000000 AND Size > 20000000
to filter files between 5MB and 20MB.
-
Drag and drop a Foreach Loop Container.
- In the Collection tab, use the Foreach ADO Enumerator option and select the variable used to save the file list.
-
In the Variable Mapping tab, select a string variable to get the full path from the FileList variable.
-
Drag and drop another Advanced File System Task inside the Foreach Loop Container.
- Select the action Copy file(s). Use the variable for the source file path and the destination path.
-
Run the package, which will copy files between 5MB and 20 MB.
-
Optionally, use a Logging Task inside the Foreach Loop Container to save the copy file information in a file.
Method 2: Using the Copy Option with the Filter
- Drag and drop an Advanced File System Task.
- Select the option Copy files and choose your desired source and destination path:
-
Go to the Filter and Sorting tab and use the expression
Size > 5000000 AND Size > 20000000
to filter files between 5MB and 20MB.
-
Run the package, and it will copy files between 5MB and 20 MB.
Conclusion
Following these steps, you can easily use functions for your file paths in SSIS. For further assistance or inquiries, contact our support team via chat on our website or through email at support@zappysys.com.
Reference
For more detailed information, refer to our Format Specifiers / Placeholder Functions article.