Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Anzahl Files und dafür belegter Speicherplatz auslesen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Anzahl Files und dafür belegter Speicherplatz auslesen

    This topic has been deleted. Only users with topic management privileges can see it.
    • metaxa
      metaxa @David G. last edited by

      @david-g Ich habe nun das Skript fertig und es strukturiert und zerteilt die Daten schon mal sehr gut. Es gefällt mir nur nicht, dass in meinem Falle 8x in einem Script das Exec Commando genutzt wird. Ich kanns ned festmachen, aber ich denke es ist ned gescheit. Hier mal das aktuelle Skript, ich überlege mir nur schon eine andere Lösung anzugehen.

      eaf422cc-9a81-48aa-898e-8a16698896b9-image.png
      79ea1f53-1263-4f95-9834-189b4eed49f2-image.png
      26c86743-5cc2-4328-92d0-32786f2eacd0-image.png
      1f77d09f-b335-48d8-8f5b-f1d3b6fcfb03-image.png
      f5e1020d-e731-446d-a5f0-da213b0b823f-image.png
      88cf6c3a-bc45-4fe5-b319-00b1368727d7-image.png
      LG, mxa

      David G. 1 Reply Last reply Reply Quote 0
      • David G.
        David G. @metaxa last edited by

        @metaxa

        Ka ob das viele exec schadet.
        Es gibt ja noch den Adapter Linux control. Evtl kann der sowas. Hab den noch nie getestet.

        1 Reply Last reply Reply Quote 0
        • liv-in-sky
          liv-in-sky last edited by liv-in-sky

          hätte hier mal eine lösung mit einem exec befehl

          dazu nutze ich diesen exec befehl

          cd /Daten/tst &&  for dir in $(find . -maxdepth 1 ! -path . -type d | sort); do du -h "$dir" | awk '{print $1}' && echo "!" && find $dir ! -path . | wc -l && echo ":" ; done
          

          danach wird das ganze zerlegt - da sic die ordner nicht ändern und immer den gleichen namen haben, verzichte ich auf die ausgabe des ordner namens

          das blockly dazu sieht so aus:

          Image 2.png

          <xml xmlns="https://developers.google.com/blockly/xml">
           <variables>
             <variable id="}Q%9|3sA+_JAy-nQitWX">x</variable>
             <variable id="8)AW;D@mAp44t}wvt_|e">result</variable>
             <variable id="?Y-XAI0#Lg.Z)vdM[*(u">myArr</variable>
             <variable id="|p6v1M$#+S{J)Bw2Z_oP">folder1</variable>
             <variable id="qb*mqaDqTNym%P/ow:lH">folder2</variable>
           </variables>
           <block type="exec" id="sAV5M1n8=yfwkuPV}4?O" x="62" y="-337">
             <mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="true"></mutation>
             <field name="WITH_STATEMENT">TRUE</field>
             <field name="LOG"></field>
             <value name="COMMAND">
               <shadow type="text" id="fm)hU(q@YE/ghEy#1Uy,">
                 <field name="TEXT">cd /Daten &amp;&amp; for dir in $(find . -maxdepth 1 ! -path . -type d | sort); do du -h "$dir" &amp;&amp; echo "," &amp;&amp; find $dir ! -path . | wc -l &amp;&amp; echo ":" ; done</field>
               </shadow>
               <block type="text_join" id="2w7U,KoKjz`66J^e#2R]">
                 <mutation items="2"></mutation>
                 <value name="ADD0">
                   <block type="text" id="V{-|:sSjp(.Q8^p{l!.B">
                     <field name="TEXT">cd /Daten/tst &amp;&amp;</field>
                   </block>
                 </value>
                 <value name="ADD1">
                   <block type="text" id="^It#Lk-[ObISw[6/O-Bh">
                     <field name="TEXT"> for dir in $(find . -maxdepth 1 ! -path . -type d | sort); do du -h "$dir" | awk '{print $1}' &amp;&amp; echo "!" &amp;&amp; find $dir ! -path . | wc -l &amp;&amp; echo ":" ; done</field>
                   </block>
                 </value>
               </block>
             </value>
             <statement name="STATEMENT">
               <block type="debug" id="df;V]pD;MJvDs,W[XNe}">
                 <field name="Severity">log</field>
                 <value name="TEXT">
                   <shadow type="text" id="VAs+PBiWP[Ms8bn.]ul2">
                     <field name="TEXT">test</field>
                   </shadow>
                   <block type="variables_get" id="pTh@%uw3`RkQ1+Q^S@*6">
                     <field name="VAR" id="8)AW;D@mAp44t}wvt_|e">result</field>
                   </block>
                 </value>
                 <next>
                   <block type="comment" id=":.OFdoZD5YAp0)nuho8z">
                     <field name="COMMENT">ergebnis in einen dp schreiben</field>
                     <next>
                       <block type="control" id="m`F_7,8]|]jz_0~0%IPm" disabled="true">
                         <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                         <field name="OID">0_userdata.0.daten-exec</field>
                         <field name="WITH_DELAY">FALSE</field>
                         <value name="VALUE">
                           <block type="variables_get" id="9^!=Ho$uhdsm.%O$5F:z">
                             <field name="VAR" id="8)AW;D@mAp44t}wvt_|e">result</field>
                           </block>
                         </value>
                         <next>
                           <block type="variables_set" id=")v0-yhs=R(]PS@]==Z::">
                             <field name="VAR" id="8)AW;D@mAp44t}wvt_|e">result</field>
                             <value name="VALUE">
                               <block type="procedures_callcustomreturn" id="LG**PB`/{}=T/e[ovRf}">
                                 <mutation name="etwas tun2">
                                   <arg name="x"></arg>
                                 </mutation>
                                 <value name="ARG0">
                                   <block type="variables_get" id="TUL*_WGDMTzIkGCv:,e0">
                                     <field name="VAR" id="8)AW;D@mAp44t}wvt_|e">result</field>
                                   </block>
                                 </value>
                               </block>
                             </value>
                             <next>
                               <block type="variables_set" id="9(3yPN|9!yhUHC.[,K3l">
                                 <field name="VAR" id="?Y-XAI0#Lg.Z)vdM[*(u">myArr</field>
                                 <value name="VALUE">
                                   <block type="lists_create_with" id="{ws?zJvprU]rO|Wm-upX">
                                     <mutation items="0"></mutation>
                                   </block>
                                 </value>
                                 <next>
                                   <block type="variables_set" id="x-H6kkb5GRS3Px`K+*fQ">
                                     <field name="VAR" id="?Y-XAI0#Lg.Z)vdM[*(u">myArr</field>
                                     <value name="VALUE">
                                       <block type="lists_split" id="VZwEGc1-ZEht`[=X@/IJ">
                                         <mutation mode="SPLIT"></mutation>
                                         <field name="MODE">SPLIT</field>
                                         <value name="INPUT">
                                           <block type="variables_get" id="sx)les~jw_!sd0Mz31*[">
                                             <field name="VAR" id="8)AW;D@mAp44t}wvt_|e">result</field>
                                           </block>
                                         </value>
                                         <value name="DELIM">
                                           <shadow type="text" id="5|!nL4UX?%o^Hez]b?:S">
                                             <field name="TEXT">:</field>
                                           </shadow>
                                         </value>
                                       </block>
                                     </value>
                                     <next>
                                       <block type="debug" id="_wt]`P`hgm,t*4LSz8Z;">
                                         <field name="Severity">log</field>
                                         <value name="TEXT">
                                           <shadow type="text" id="|kZsk|RU##;e-empnnTP">
                                             <field name="TEXT">test</field>
                                           </shadow>
                                           <block type="variables_get" id="{-iiKp,%$t#-GM#`Fy-%">
                                             <field name="VAR" id="?Y-XAI0#Lg.Z)vdM[*(u">myArr</field>
                                           </block>
                                         </value>
                                         <next>
                                           <block type="variables_set" id="=|:#.}_W|cVf*l(*?4X7">
                                             <field name="VAR" id="|p6v1M$#+S{J)Bw2Z_oP">folder1</field>
                                             <value name="VALUE">
                                               <block type="lists_split" id="eZVrVw3bzRqjYqvFnKhg">
                                                 <mutation mode="SPLIT"></mutation>
                                                 <field name="MODE">SPLIT</field>
                                                 <value name="INPUT">
                                                   <block type="lists_getIndex" id="SyciJ@~R7DS4:Aao`@-5">
                                                     <mutation statement="false" at="true"></mutation>
                                                     <field name="MODE">GET</field>
                                                     <field name="WHERE">FROM_START</field>
                                                     <value name="VALUE">
                                                       <block type="variables_get" id="i_Wh_!?_y@MTN_MB]y)V">
                                                         <field name="VAR" id="?Y-XAI0#Lg.Z)vdM[*(u">myArr</field>
                                                       </block>
                                                     </value>
                                                     <value name="AT">
                                                       <block type="math_number" id="[zh3V2~d9yV*0uf;63#^">
                                                         <field name="NUM">1</field>
                                                       </block>
                                                     </value>
                                                   </block>
                                                 </value>
                                                 <value name="DELIM">
                                                   <shadow type="text" id="X06{xbe^z.@0Ka$HJ5=8">
                                                     <field name="TEXT">!</field>
                                                   </shadow>
                                                 </value>
                                               </block>
                                             </value>
                                             <next>
                                               <block type="comment" id="1N4YMAw27YY%k0*v@I:S">
                                                 <field name="COMMENT">hier ann in die dp geschrieben werden</field>
                                                 <next>
                                                   <block type="comment" id="S[+FJ#B@STH?;sh)dk]l">
                                                     <field name="COMMENT">größe</field>
                                                     <next>
                                                       <block type="debug" id="fil?:$4a(c=YXpx,f!#_">
                                                         <field name="Severity">log</field>
                                                         <value name="TEXT">
                                                           <shadow type="text">
                                                             <field name="TEXT">test</field>
                                                           </shadow>
                                                           <block type="lists_getIndex" id="dxVBJGr[xS`+5bb(NRl{">
                                                             <mutation statement="false" at="true"></mutation>
                                                             <field name="MODE">GET</field>
                                                             <field name="WHERE">FROM_START</field>
                                                             <value name="VALUE">
                                                               <block type="variables_get" id="J8x,atUNuBT409a`OWL6">
                                                                 <field name="VAR" id="|p6v1M$#+S{J)Bw2Z_oP">folder1</field>
                                                               </block>
                                                             </value>
                                                             <value name="AT">
                                                               <block type="math_number" id="dH(Pc@nL=pHS(^4STKbB">
                                                                 <field name="NUM">1</field>
                                                               </block>
                                                             </value>
                                                           </block>
                                                         </value>
                                                         <next>
                                                           <block type="comment" id=")3S]-9:_D8DIwv6[7$vp">
                                                             <field name="COMMENT">anzahl files</field>
                                                             <next>
                                                               <block type="debug" id="fn;;/-^.ja:laGsJUMC+">
                                                                 <field name="Severity">log</field>
                                                                 <value name="TEXT">
                                                                   <shadow type="text" id="]o[:e$4`GVy37.;!c+#{">
                                                                     <field name="TEXT">test</field>
                                                                   </shadow>
                                                                   <block type="math_arithmetic" id="^!N%44B3mVkegZ=p$R:b">
                                                                     <field name="OP">MINUS</field>
                                                                     <value name="A">
                                                                       <shadow type="math_number" id="C@Z{d;RK/DtE0bUpvs2P">
                                                                         <field name="NUM">1</field>
                                                                       </shadow>
                                                                       <block type="lists_getIndex" id="xAs~Rj%@2V9lpe455b7^">
                                                                         <mutation statement="false" at="true"></mutation>
                                                                         <field name="MODE">GET</field>
                                                                         <field name="WHERE">FROM_START</field>
                                                                         <value name="VALUE">
                                                                           <block type="variables_get" id="]9%{7VyN?H-TUAO{v{bR">
                                                                             <field name="VAR" id="|p6v1M$#+S{J)Bw2Z_oP">folder1</field>
                                                                           </block>
                                                                         </value>
                                                                         <value name="AT">
                                                                           <block type="math_number" id="WK*B.v1*S;{o5[i^=:Qn">
                                                                             <field name="NUM">2</field>
                                                                           </block>
                                                                         </value>
                                                                       </block>
                                                                     </value>
                                                                     <value name="B">
                                                                       <shadow type="math_number" id="t2d8B`)=0%eZd,{{h8;]">
                                                                         <field name="NUM">1</field>
                                                                       </shadow>
                                                                     </value>
                                                                   </block>
                                                                 </value>
                                                                 <next>
                                                                   <block type="variables_set" id="OvR^GKjRohbG0qCj@(QL">
                                                                     <field name="VAR" id="qb*mqaDqTNym%P/ow:lH">folder2</field>
                                                                     <value name="VALUE">
                                                                       <block type="lists_split" id="GK=]o5.m7H#085YqB8Zx">
                                                                         <mutation mode="SPLIT"></mutation>
                                                                         <field name="MODE">SPLIT</field>
                                                                         <value name="INPUT">
                                                                           <block type="lists_getIndex" id="~X~@JU+U3AUUeV|:wq#7">
                                                                             <mutation statement="false" at="true"></mutation>
                                                                             <field name="MODE">GET</field>
                                                                             <field name="WHERE">FROM_START</field>
                                                                             <value name="VALUE">
                                                                               <block type="variables_get" id="yEXe~TS##Kg0EM%Oq)ud">
                                                                                 <field name="VAR" id="?Y-XAI0#Lg.Z)vdM[*(u">myArr</field>
                                                                               </block>
                                                                             </value>
                                                                             <value name="AT">
                                                                               <block type="math_number" id="Ybi$JKX45leDj|!80Y~I">
                                                                                 <field name="NUM">2</field>
                                                                               </block>
                                                                             </value>
                                                                           </block>
                                                                         </value>
                                                                         <value name="DELIM">
                                                                           <shadow type="text" id="zF(1[A@*Y?NA7?m_-s-$">
                                                                             <field name="TEXT">!</field>
                                                                           </shadow>
                                                                         </value>
                                                                       </block>
                                                                     </value>
                                                                     <next>
                                                                       <block type="debug" id="d{cBv=eb2+ME|ML]k+Nh">
                                                                         <field name="Severity">log</field>
                                                                         <value name="TEXT">
                                                                           <shadow type="text" id="i7r^9~o%lu[DFY[Ju1-p">
                                                                             <field name="TEXT">test</field>
                                                                           </shadow>
                                                                           <block type="lists_getIndex" id=",)z/t5Un@9$#|[3S.%x;">
                                                                             <mutation statement="false" at="true"></mutation>
                                                                             <field name="MODE">GET</field>
                                                                             <field name="WHERE">FROM_START</field>
                                                                             <value name="VALUE">
                                                                               <block type="variables_get" id="I`=)FzifuIcR_l%/!DJK">
                                                                                 <field name="VAR" id="qb*mqaDqTNym%P/ow:lH">folder2</field>
                                                                               </block>
                                                                             </value>
                                                                             <value name="AT">
                                                                               <block type="math_number" id="b^Pzm{~y3S@,w(`rGBiX">
                                                                                 <field name="NUM">1</field>
                                                                               </block>
                                                                             </value>
                                                                           </block>
                                                                         </value>
                                                                         <next>
                                                                           <block type="debug" id="i=o6M4x2P.yR*$:^)Nmt">
                                                                             <field name="Severity">log</field>
                                                                             <value name="TEXT">
                                                                               <shadow type="text" id="i4GjMIrrl*`#5,LiruP5">
                                                                                 <field name="TEXT">test</field>
                                                                               </shadow>
                                                                               <block type="math_arithmetic" id="Hyg3tq}cJAw_,;-~~lro">
                                                                                 <field name="OP">MINUS</field>
                                                                                 <value name="A">
                                                                                   <shadow type="math_number" id="UA1!UyVhH31mP3P^eG2Q">
                                                                                     <field name="NUM">1</field>
                                                                                   </shadow>
                                                                                   <block type="lists_getIndex" id="@FBZDM)j~;N:O?Gri~Mk">
                                                                                     <mutation statement="false" at="true"></mutation>
                                                                                     <field name="MODE">GET</field>
                                                                                     <field name="WHERE">FROM_START</field>
                                                                                     <value name="VALUE">
                                                                                       <block type="variables_get" id="GG~5vi,%R~%iHUZ[5#3H">
                                                                                         <field name="VAR" id="qb*mqaDqTNym%P/ow:lH">folder2</field>
                                                                                       </block>
                                                                                     </value>
                                                                                     <value name="AT">
                                                                                       <block type="math_number" id="BTnPhD3+)Oaev7.gbSmO">
                                                                                         <field name="NUM">2</field>
                                                                                       </block>
                                                                                     </value>
                                                                                   </block>
                                                                                 </value>
                                                                                 <value name="B">
                                                                                   <shadow type="math_number" id="yD5GwHBEGeI_,#aVUcyb">
                                                                                     <field name="NUM">1</field>
                                                                                   </shadow>
                                                                                 </value>
                                                                               </block>
                                                                             </value>
                                                                             <next>
                                                                               <block type="comment" id="+.9q(aN/,[2L-BL#TE^8">
                                                                                 <field name="COMMENT">usw</field>
                                                                               </block>
                                                                             </next>
                                                                           </block>
                                                                         </next>
                                                                       </block>
                                                                     </next>
                                                                   </block>
                                                                 </next>
                                                               </block>
                                                             </next>
                                                           </block>
                                                         </next>
                                                       </block>
                                                     </next>
                                                   </block>
                                                 </next>
                                               </block>
                                             </next>
                                           </block>
                                         </next>
                                       </block>
                                     </next>
                                   </block>
                                 </next>
                               </block>
                             </next>
                           </block>
                         </next>
                       </block>
                     </next>
                   </block>
                 </next>
               </block>
             </statement>
           </block>
           <block type="procedures_defcustomreturn" id="G+G|FF.jplS-,36(V7!J" x="787" y="-338">
             <mutation statements="false">
               <arg name="x" varid="}Q%9|3sA+_JAy-nQitWX"></arg>
             </mutation>
             <field name="NAME">etwas tun2</field>
             <field name="SCRIPT">DQoNCnJldHVybiB4LnJlcGxhY2UoL1xuL2dtLCIiKTsNCg==</field>
             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
           </block>
          </xml>
          

          metaxa 1 Reply Last reply Reply Quote 1
          • metaxa
            metaxa @liv-in-sky last edited by

            @liv-in-sky Hi und danke! Kannst du mir mal einen Screen hier reinstellen wie die erzeugten DP in der Praxis aussehen?
            Lieben Dank

            liv-in-sky 1 Reply Last reply Reply Quote 0
            • liv-in-sky
              liv-in-sky @metaxa last edited by

              @metaxa

              du kannst deine eigenen d-punkte nehmen (anstatt meinen debugs , schreibst du in deine datenpunkte )- im script muss du nur deinen folder noch im exec eingeben und dann mal im log schauen, was da raus kommt

              es kommt immer die größe und dann die anzahl

              teste mal ohne datenpunjte zu schreiben und im log erkennst du schon, was da kommt

              metaxa 1 Reply Last reply Reply Quote 0
              • metaxa
                metaxa @liv-in-sky last edited by

                @liv-in-sky sagte in Anzahl Files und dafür belegter Speicherplatz auslesen:

                deine datenpunkte

                Du hast recht, ein Versuch ist es allemal wert 😉
                Wobei, ich bin mit meinem endgültigen Ergebnis auch recht zufrieden, probiere aber deine Herangehensweise natürlich aus.
                714abc87-2d7a-454c-b4ff-f0031c66c696-image.png
                LG, mxa

                liv-in-sky 1 Reply Last reply Reply Quote 0
                • liv-in-sky
                  liv-in-sky @metaxa last edited by liv-in-sky

                  @metaxa nimm das, was dir am besten paßt - eigene scripte , die funktionieren, sind immer besser - selbst gemacht, da kennt man sich aus

                  edit:
                  deine dp-struktur bleibt gleich - nur du mußt halt nicht soviele exec ausführen

                  metaxa 1 Reply Last reply Reply Quote 0
                  • metaxa
                    metaxa @liv-in-sky last edited by

                    @liv-in-sky ich habe jetzt deine Befehlszeile angepasst ausgeführt.
                    Result:

                    andreas@ioBroker-Prod:~$ cd /mnt/ftp_cam && for dir in $(find . -maxdepth 1 ! -path . -type d | sort); do du -h "$dir" | awk '{print $1}' && echo "!" && find $dir ! -path . | wc -l && echo ":" ; done
                    3,2G
                    !
                    10911
                    :
                    3,1G
                    !
                    6818
                    :
                    6,0G
                    2,8G
                    8,8G
                    8,8G
                    !
                    33692
                    :
                    5,0G
                    6,0G
                    11G
                    11G
                    !
                    39365
                    :
                    

                    Die Werte die da stehen decken sich da und dort mit den Meinigen, aber nicht alle kann ich wirklich zuordnen.
                    Weist du eventuell, ob mehrere Execaufrufe - in meinem Skript 8 oder 9 - Probleme verursachen können? Die Prozessorlast in Proxmox bleibt davon unbeeindruckt wenn ich alle Stunden das Script laufen lasse.

                    liv-in-sky 2 Replies Last reply Reply Quote 0
                    • liv-in-sky
                      liv-in-sky @metaxa last edited by

                      @metaxa Ich denke, dass sollte kein Performance Problem sein
                      Ich würde vielleicht noch ein

                      && exit
                      

                      An jedes der befehlzeilen setzen, damit sicher ist, dass die Verbindungen geschlossen sind

                      Das& && fügt einfach einen Befehl dazu

                      1 Reply Last reply Reply Quote 0
                      • liv-in-sky
                        liv-in-sky @metaxa last edited by

                        @metaxa wenn du das

                        | awk '{print $1}'
                        

                        Aus dem Befehl nimmst, solltest du auch das Verzeichnis in der Konsole sehen
                        Wegen der ZuOrdnung
                        Dann funktioniert es aber im Blocky nicht mehr

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        894
                        Online

                        31.9k
                        Users

                        80.1k
                        Topics

                        1.3m
                        Posts

                        communication
                        4
                        21
                        454
                        Loading More Posts
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes
                        Reply
                        • Reply as topic
                        Log in to reply
                        Community
                        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                        The ioBroker Community 2014-2023
                        logo