1

Using Pentaho's Kettle tool, I have a transformation set up that starts with a Get File Names step to grab all XML files from a directory. The step is configured like this:

File/Directory: "c:\DataFolder"
Wildcard (RegExp): ".*xml"

This works great and gives me all the XML files in the folder "DataFolder".

However, if the DataFolder isn't present (because someone else deleted it), I get this error:

2012/11/30 12:15:27 - FileInputList - ERROR (version 4.3.0-stable, build 16786 from 2012-04-24 14.11.32 by buildguy) : org.apache.commons.vfs.FileNotFolderException: Could not list the contents of "file:///c:/DataFolder" because it is not a folder.
2012/11/30 12:15:27 - FileInputList - ERROR (version 4.3.0-stable, build 16786 from 2012-04-24 14.11.32 by buildguy) :  at org.apache.commons.vfs.provider.AbstractFileObject.getChildren(Unknown Source)
2012/11/30 12:15:27 - FileInputList - ERROR (version 4.3.0-stable, build 16786 from 2012-04-24 14.11.32 by buildguy) :  at org.pentaho.di.core.fileinput.FileInputList.createFileList(FileInputList.java:268)
2012/11/30 12:15:27 - FileInputList - ERROR (version 4.3.0-stable, build 16786 from 2012-04-24 14.11.32 by buildguy) :  at org.pentaho.di.trans.steps.getfilenames.GetFileNamesMeta.getFileList(GetFileNamesMeta.java:690)
2012/11/30 12:15:27 - FileInputList - ERROR (version 4.3.0-stable, build 16786 from 2012-04-24 14.11.32 by buildguy) :  at org.pentaho.di.trans.steps.getfilenames.GetFileNames.init(GetFileNames.java:336)
2012/11/30 12:15:27 - FileInputList - ERROR (version 4.3.0-stable, build 16786 from 2012-04-24 14.11.32 by buildguy) :  at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:62)
2012/11/30 12:15:27 - FileInputList - ERROR (version 4.3.0-stable, build 16786 from 2012-04-24 14.11.32 by buildguy) :  at java.lang.Thread.run(Unknown Source)

or in short: FileNotFolderException: Could not list the contents of "file:///c:/DataFolder" because it is not a folder.

If the folder doesn't exist, I want to simply stop the transformation and not proceed.

I've tried using the File Exists step combined with a Filter Rows step to provide a conditional, but no luck. The Hello World tutorial shows you how to check if a file exists, but not an entire folder.

Mike
  • 5,560
  • 12
  • 41
  • 52

1 Answers1

2

create a parent job, add this http://wiki.pentaho.com/display/EAI/Check+if+a+folder+is+empty and then if FALSE redir your flow to your transformation

or you could try with create folder step job: http://wiki.pentaho.com/display/EAI/Create+a+folder

jacktrade
  • 3,125
  • 2
  • 36
  • 50
  • using the latest version of Spoon (4.3.0) I don't see the Check If A Folder Is Empty job that your link describes. This link http://infocenter.pentaho.com/help/index.jsp?topic=%2Fpdi_user_guide%2Freference_entry_check_folder_empty.html puts it under "Conditions" which isn't found in my version of Spoon. – Mike Dec 03 '12 at 14:38
  • i am on 4.3 also, thats why you need to make a new job, not a transformation, because its a job step, not a transformation step. – jacktrade Dec 03 '12 at 19:04
  • yes, you are correct, thanks for the clarification. I created a parent job (as you stated), and the Check if a folder is empty did the trick. – Mike Dec 03 '12 at 22:24