how to check files are arrived in folder or not?

72 views Asked by At

Need to Send list of files name used the SSIS to check the files are arrived in folder or not ? if not then send mail files are not arrived, if arrived then send mail this files arrived into folder with list of files name ?

1

There are 1 answers

0
KeithL On

here is a quick answer...

Use a script task (with 1 output variable) to get a file list in the folder:

You need to add Namespaces: System.IO; System.Linq;

//Array of file names in a folder
var fileList = new DirectoryInfo([folderPath]).GetFiles().Select(f => f.Name);

//Convert array to run list
string fileListString = string.Join(Environment.NewLine, fileList);

//Load string into variable
Dts.Variables("Your variable Name").Value = fileListString;

Have two paths coming out of script based on length of variable.

if LEN(variable) == 0 then send no file email

if LEN(variable) != 0 then send files received email with variable in the body.