[SOLVED] delete all files in one folder

xDStickerxDSticker Member Posts: 16 Contributor II
edited November 2018 in Help
Dear Data-Miners,

I working on a clsuter process to identify if a product belongs to a cluster or to another. While the process is running, it creates one model per cluster-basket and save it in a seperate folder "cluster models". Normaly it overwrite the old models if I run the process again. But often I try other basket-counts and when i change it e.g. from 100 to 50 it just overwirte the first 50 models. When the next process iterate over the "cluster models"-folder, it find the old models (51-100) too and try to predict with them.

So I want to clean up the folder in my repository by a process before it creats the new models. I thought it would be easy to do so, but its dosnt work.

My process just delete one file per run (or nothing) and the RMiner sometimes throw an exception. Maybe you can help me ;)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.005">
 <context>
   <input/>
   <output/>
   <macros/>
 </context>
 <operator activated="true" class="process" compatibility="5.3.005" expanded="true" name="Process">
   <process expanded="true">
     <operator activated="true" class="loop_repository" compatibility="5.3.005" expanded="true" height="76" name="Delete Old Models" width="90" x="313" y="30">
       <parameter key="repository_folder" value="cluster modell/"/>
       <parameter key="entry_type" value="IOObject"/>
       <process expanded="true">
         <operator activated="true" class="delete_file" compatibility="5.3.005" expanded="true" height="76" name="Delete File" width="90" x="313" y="30">
           <parameter key="file" value="cluster modell/%{entry_name}"/>
         </operator>
         <connect from_port="in 1" to_op="Delete File" to_port="through 1"/>
         <connect from_op="Delete File" from_port="through 1" to_port="out 1"/>
         <portSpacing port="source_repository object" spacing="0"/>
         <portSpacing port="source_in 1" spacing="0"/>
         <portSpacing port="source_in 2" spacing="0"/>
         <portSpacing port="sink_out 1" spacing="0"/>
         <portSpacing port="sink_out 2" spacing="0"/>
       </process>
     </operator>
     <connect from_op="Delete Old Models" from_port="out 1" to_port="result 1"/>
     <portSpacing port="source_input 1" spacing="0"/>
     <portSpacing port="sink_result 1" spacing="0"/>
     <portSpacing port="sink_result 2" spacing="0"/>
   </process>
 </operator>
</process>

Answers

  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Use Delete Repository Entry instead of Delete File.
    When deleting the complete folder, you could even remove the Loop operator.

    Best regards,
    Marius
  • xDStickerxDSticker Member Posts: 16 Contributor II
    Okay, but i can't find the "Create Folder"-Element because I need the folder for the new models...

    Thanks
    Sticker
  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    You are right, that's still missing. But if you save a model in  a non-existing repository folder with the Store operator, the folder will be created.

    Best regards,
    Marius
Sign In or Register to comment.