Question

Directory watch file types

  • 9 December 2015
  • 2 replies
  • 2 views

Badge +5

Is there a way to control which file types directory watch processes? I have a process set up to run xml files triggered through directory watch. Folders containing jpgs are also copied to this directory (I have no control over this). These folders trigger the process then fail. Is there some way to tell directory watch to only process xmls?


2 replies

Userlevel 4

Hi

You should analyze the JSON that is generated by the watcher to test for the file type. Here is a sample message:

{
    "ws_topic": "SAMPLE_TOPIC",
    "dirwatch_publisher_path": "c:\\temp\\test.xml",
    "dirwatch_publisher_content": "ENTRY_CREATE c:\\temp\\test.xml",
    "dirwatch_publisher_action": "CREATE",
    "fns_type": "dirwatch_publisher"
}

In other words, you should test that "dirwatch_publisher_content" ends with ".xml" before starting your process.

David

Userlevel 4
Badge +13

@swach, David definitely has the right idea. Speaking of ideas, it would be great if you filed this request in our Ideas database: https://knowledge.safe.com/content/idea/post.html

Then the rest of the community can vote it up. More votes equals more likely to get done. Thanks for getting involved!

Reply