No announcement yet.

On the fly creation of folders on the filesystem

  • Filter
  • Time
  • Show
Clear All
new posts

  • On the fly creation of folders on the filesystem

    Hi !
    I'm using this kind of channel :
    - Incoming messages : HL7
    - Channel source/type : LLP Listener
    - Destination 1 => File Writer

    For example, I have to log messages for an other application and store it into a directory like c:\hl7_incoming\XXXXXXXXXX\ where XXXXXXXXXX is the id of the patient stored in the messages.

    How can i dynamically create the folders ...
    I don't know the name of the folder and i have to create it before if it does not exist ... I'm not "Madame IRMA" ...

    I don't know how to do this
    Maybe using :
    * in the filter, by the "Call System Function" java.lang.Runtime.getRuntime().exec("system_comman d"); ??? (but what command to use and how to do this ...)
    * by using a Java class ???
    * if there's no other solution for this, i will use an other destination who's using an HTTP Sender that send parameters to PHP script doing this kind of work ...

    Does someone got the solution(s). This could be very useful ...
    Thanks for your replies and have a nice day.

    [using Mirth 1.6.1 build 2750 / Win XP | beginner]

  • #2
    Re:On the fly creation of folders on the filesystem

    If you want to use the command-line, and you're using XP you need to execute the next command: "mkdir dirname" (where direname is the full path of the dir you want to create).

    Another option:, use the File Java class in a transformer. this should be something like_

    var f=new java,io.File("fike_full_path");