Mirth: How to get source file directory from file reader channel

Jeremy picture Jeremy · Oct 23, 2009 · Viewed 7.4k times · Source

I have a file reader channel picking up an xml document. By default, a file reader channel populates the 'originalFilename' in the channel map, which ony gives me the name of the file, not the full path. Is there any way to get the full path, withouth having to hard code something?

Answer

jonduncan05 picture jonduncan05 · Mar 20, 2012

You can get any of the Source reader properties like this:

var sourceFolder = Packages.com.mirth.connect.server.controllers.ChannelController.getInstance().getDeployedChannelById(channelId).getSourceConnector().getProperties().getProperty('host');

I put it up in the Mirth forums with a list of the other properties you can access http://www.mirthcorp.com/community/forums/showthread.php?t=2210