Announcement

Collapse
No announcement yet.

destination file writer limit file size

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #2
    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

    Comment


    • #3
      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() 

      Comment

      Working...
      X