title: Execute command for every file in the current dir
body: <p>How can i execute a certain command for every file/folder in the current folder?</p>
  
  <p>I've started with this as a base script, but this seems that its only working when using temporary files, and i dont really like the ideea. Is there any other way?</p>
  
  <pre><code>FOLDER=".";
  DIRS=`ls -1 "$FOLDER"&gt;/tmp/DIRS`;
  
  echo &gt;"/tmp/DIRS1";
  while read line ; do
      SIZE=`du "$FOLDER$line"`;
      echo $SIZE&gt;&gt;"/tmp/DIRS1";
  done &lt; "/tmp/DIRS";
  </code></pre>
  
  <hr>
  
  <p>For anyone interested, i wanted to make a list of folders, sorted by their size. Here is the final result</p>
  
  <pre><code>FOLDER="$1";
  for f in $FOLDER/*; do 
    du -sb "$f";
  done | sort -n | sed "s#^[0-9]*##" | sed "s#^[^\./]*##" | xargs -L 1 du -sh | sed "s|$FOLDER||";
  </code></pre>
  
  <p>which leads to <code>du -sb $FOLDER/* | sort -n | sed "s#^[0-9]*##" | sed "s#^[^\./]*##" | xargs -L 1 du -sh | sed "s|$FOLDER||";</code></p>