Delete a list of files of an specified size using the Advanced SSIS File System Task in SSIS

Introduction

In this article, we will show you two ways to delete files greater than 10 MBs using our Advanced File System Task. For additional information about the task, you can refer to our dedicated article here.

Method 1: Using Foreach Loop Container

  1. Drag and drop an Advanced File System Task with the following configuration:
  1. Go to the Filter and Sorting tab and use the expression Size > 10000000 to filter files larger than 10 MBs.

  2. Drag and drop a Foreach Loop Container.

  1. In the Variable Mapping tab, select a string variable to get the full path from the FileList variable.

  2. Drag and drop another Advanced File System Task inside the Foreach Loop Container.

  1. Run the package, and it will delete files above 10 MB in size.

  2. Optionally, use a Logging Task inside the Foreach Loop Container to save the deleted file information in a file.

Method 2: Using the Delete Option with the Filter

  1. Drag and drop an Advanced File System Task.
  1. Go to the Filter and Sorting tab and use the expression Size > 10000000 to filter files larger than 10 MBs.

  2. Run the package, and it will delete files above 10 MB in size.

Using either method, you can efficiently delete files based on your size criteria. If you encounter any issues or need further assistance, feel free to contact our support team via chat on our website