[SOLVED] Accessing file meta data such as "date modified"

tennenrishin
tennenrishin New Altair Community Member
edited November 5 in Community Q&A
Is there any way in RM to access, for example, the date at which some given file (in the file system) was modified?
Tagged:

Answers

  • MariusHelf
    MariusHelf New Altair Community Member
    Not out of the box, however you could probably use the Execute Program operator to fire up an external tool which delivers the desired data.

    Best regards,
    Marius
  • Marco_Boeck
    Marco_Boeck New Altair Community Member
    Hi,

    actually there is a way :)
    However it involves the Script operator and you do need Java 7 for it.
    A quick example on how it can be done:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.008">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="5.3.008" expanded="true" name="Process">
       <process expanded="true">
         <operator activated="true" class="execute_script" compatibility="5.3.008" expanded="true" height="60" name="Execute Script" width="90" x="179" y="30">
           <parameter key="script" value="import java.nio.file.Files;&#10;import java.nio.file.Paths;&#10;import javax.swing.JOptionPane;&#10;&#10;JOptionPane.showMessageDialog(null, &quot;File last modified: &quot; + Files.getLastModifiedTime(Paths.get(&quot;C:&quot;, &quot;Users&quot;, &quot;username&quot;, &quot;Desktop&quot;, &quot;Test.txt&quot;)));"/>
         </operator>
         <portSpacing port="source_input 1" spacing="0"/>
         <portSpacing port="sink_result 1" spacing="0"/>
       </process>
     </operator>
    </process>
    Regards,
    Marco
  • tennenrishin
    tennenrishin New Altair Community Member
    Thank you!