web stats
destination file writer limit file size - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-03-2020, 08:59 AM
mpdev mpdev is offline
What's HL7?
 
Join Date: Feb 2020
Posts: 1
mpdev is on a distinguished road
Default destination file writer limit file size

On a mirth 3.8.0 install I have a test in bound feed that I'm writing to a text file at the moment. I've searched around but haven't been able to find a way to limit the file size of the text files. For example: If I wanted the file size to not go over 100 MB, the system would stop writing to say Test1.txt at 100 MB and would create Test2.txt to continue writing to.

Is there a way to do this from the mirth controls or what it have to be done through scripts?
Reply With Quote
  #2  
Old 02-16-2020, 11:26 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 613
kirbykn2 is on a distinguished road
Default

I keep my files from getting too large by including a date/time stamp in the filename.

DateUtil.getCurrentDate('yyyyMMddhhm')+'_apptsVisi ts.csv';

I am sure you can do it by a specific size, but you would probably have to get the file size before each write.
__________________
Best,

Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.4
Mirth Connect Version 3.8.0
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_181-b13
PostgreSQL Version 9.6.8
Reply With Quote
  #3  
Old 02-17-2020, 12:40 AM
obsessio obsessio is offline
Mirth Guru
 
Join Date: Mar 2015
Location: Turkey
Posts: 177
obsessio is on a distinguished road
Default

In addition to kirbykn2's response,
You can use Javascript Writer instead of the File Writer. And you can read the file size with
PHP Code:
java.nio.file.Files.size() 
and writing the data into the file with
PHP Code:
FileUtil.write() 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:31 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation