user17084213
user17084213

Reputation: 13

how to check files are arrived in folder or not?

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 ?

Upvotes: 0

Views: 93

Answers (1)

KeithL
KeithL

Reputation: 5594

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.

Upvotes: 0

Related Questions