Filter by file size, name, date for Amazon / Azure Storage SSIS Task

Introduction

Sometimes you may need to make an advanced filtering on file path, file date, size etc in SSIS Amazon S3 Task or SSIS Azure Blob Storage Task . For example, you have a directory “Customers“, which contains client directories. Each of them contains a directory named “Invoices“, which is partitioned by year. E.g. “Customers/Microsoft/Invoices/2015”. So if you want to get all invoices of all customers of all years, use Advanced Filter & Sorting option and configure Where clause to use wildcards (*) like this:

SSIS Amazon/Azure Storage Task – To get all invoices of all customers of all years, use Where clause FullPath LIKE 'Customers/*/Invoices/*'

SSIS Amazon/Azure Storage Task – To get all invoices of all customers of all years, use this Where clause: FullPath LIKE ‘Customers/*/Invoices/*’

 

Prerequisites

Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
  1. SSIS designer installed. Sometimes it is referred to as BIDS or SSDT (download it from the Microsoft site).
  2. Basic knowledge of SSIS package development using Microsoft SQL Server Integration Services.
  3. Make sure ZappySys SSIS PowerPack is installed (download it, if you haven't already).
  4. (Optional step). Read this article, if you are planning to deploy packages to a server and schedule their execution later.

 

Using Advanced Search – Regex / SQL Expression (Filter by file date, size, name)

Sometimes it’s necessary to filter file based on advanced attributes such as file Age (How old), File Size, Multiple File Patterns (e.g. Delete *.zip, *.gz, *.rar in one action)

You can check this link or this link for more information. For Azure Blob Storage Task its almost same UI.

You can use Advanced Tab to filter further. First supply primary filter on Source Tab (e.g. mybucket/*.* ) and then supply your advanced filter (e.g. you can exclude *.exe and *.msi file from your delete list as below screenshot, also only delete files between 1000 and 50000 bytes in file size).

 

Delete Amazon S3 File (Multiple) using Wildcard pattern

Select / Delete Amazon S3 File (Multiple) using Wildcard pattern

 

Advanced Search in SSIS Amazon S3 Task - Use Regular Expression Patterns, SQL like expression for Sort / Filter

Advanced Search in SSIS Amazon S3 Task – Use Regular Expression Patterns, SQL like expression for Sort / Filter

 

Select Amazon S3 files older than X days

If you like to select / delete files older than certain days then use below technique.

  1. First Specify primary search criteria on Source tab
  2. Go to Advanced Filter Tab and specify Following Pattern in Where Textbox (For example delete Files older than 10 days )

Posted in SSIS Amazon Storage Task, SSIS Azure Blob Storage Task, SSIS Tips & How-Tos and tagged , , , , .