Options

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

tennenrishintennenrishin Member Posts: 177 Contributor II
Is there any way in RM to access, for example, the date at which some given file (in the file system) was modified?

Answers

  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    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
  • Options
    Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,995 RM Engineering
    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
  • Options
    tennenrishintennenrishin Member Posts: 177 Contributor II
    Thank you!
Sign In or Register to comment.