One Star

Tfileexist or TfileLIst ?

Hi,
I'm a bit lost on how to test if pdf files with wildcard (MyName_*.pdf) are available in a specific directory. I think that tFileExist can't have "generic" names as *.pdf, but the files I have to manage have random names (except extension file that is pdf). If I use tFileList, it works with generic names but how can I send an email when no files are found, and if files exist, I have to iterate to send them to assigned recipient.
To be clear:

Test if at least one file exists
If no files then send a message to warn
If one or more files exist, process them
Thans for your help.
5 REPLIES
One Star

Re: Tfileexist or TfileLIst ?

Hi,
I'm a bit lost on how to test if pdf files with wildcard (MyName_*.pdf) are available in a specific directory. I think that tFileExist can't have "generic" names as *.pdf, but the files I have to manage have random names (except extension file that is pdf). If I use tFileList, it works with generic names but how can I send an email when no files are found, and if files exist, I have to iterate to send them to assigned recipient.
To be clear:

Test if at least one file exists
If no files then send a message to warn
If one or more files exist, process them
Thans for your help.

Hi,
You can use tFileList to search the specific directory and add the mask MyName_*.pdf,
also check the checkbox "Generate error if no file found".
This will generate error if the folder doesn't contain the files you are searching for

Best Regards,
Diwakar
One Star

Re: Tfileexist or TfileLIst ?

As miniquick said, you just have to put the right filter in the tFileList component (*.pdf). Then you could use a if condition to send a mail if there are no files in the folder. In your If condition just put ((Integer)globalMap.get("tFileList_1_NB_FILE"))==0
One Star

Re: Tfileexist or TfileLIst ?

hi

I have a job which lists file in a directory and process it, if no files r found a mysql function is to be called . How to achieve this scenario
Moderator

Re: Tfileexist or TfileLIst ?

Hi banu,
I have a job which lists file in a directory and process it, if no files r found a mysql function is to be called .

What's your expect result? Do you want to call your job(lists file in a directory) by auto/ trigger as long as a file or mysql function is found?
Could you please elaborate your case with an example with input and expected output values?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Tfileexist or TfileLIst ?

Sabrina,
when i m using wild characters(*) in file names, i m getting following error. pls help me 
xception in component tFileInputExcel_1
java.lang.IllegalStateException: Zip File is closed
at org.apache.poi.openxml4j.util.ZipFileZipEntrySource.getEntries(ZipFileZipEntrySource.java:45)
at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:186)
at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:673)

but when i use full file name properly its working. pls help