cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter files from directory

SL12345
New Contributor III

Hi Snaplogic experts,

iam struggling with one task - get two files from source directory and process them (everything works fine if both files are there or one of the files is in directory)

My problem is - if both files are not presented, send an email - everything works fine if there are only two files in source directory (directory browser returns me 0 documents) - snaplogic will send an email that files are not there.problem is, if in source directory are another files, or folders - directory browser never retrieve 0 documents (logically).

So i used filter snap - but if there is no output from filter, pipeline ends and send nothing.

My question is: how to check source directory if files test1.csv and test2.csv are there (there are more files - test3.csv inovice.pdf etc) and if files are not there send an email ?

thank you

1 ACCEPTED SOLUTION

tarena
New Contributor III

The Directory Browser uses GLOB, not Regex, but you can do similar searches. Multiple patterns can be used. They must be contained in brackets. For example the following will return ‘mamma mia.csv’ and ‘snaplogic.csv’:

{mamma mia.csv, snaplogic.csv}

Check the SnapLogic documentation here for the Directory Browser file filter -here-.

View solution in original post

6 REPLIES 6

SL12345
New Contributor III

i dont know why but {mamma mia.csv} didnt work, i had to use {mamma%20mia.csv} in order to encode (empty) space between words

Supratim
Contributor III

@SL12345 You can try below option -

  1. For extracting file {test1,test2}.csv … If want to pull all file name with test try {test}.csv
  2. For error scenario -
    Make sure you dis-select that option. Then use router-
    $.hasPath(‘Name’) → for success
    !$.hasPath(‘Name’) → for failure

image