title: c shell script: find directory and rename the output of find
body: <p>i am still new in this shell script. I have  a task that given to me which i have difficulty to execute it.
  The task is i have a lot of directory which is based on ddmmyy.</p>
  
  <pre><code>03Mar2014  08Aug2013  11Jan2015  16Jan2014  22Feb2014  26Mar2014  
  03Nov2013  08Jan2014  11Jul2013  16Jul2013  22Jul2013  26Oct2014  
  03Oct2013  08Jan2015  11Nov2014  16May2014  22Mar2014  26Sep2013  
  </code></pre>
  
  <p>The task is to make the directory to mmyy.</p>
  
  <p>So far, my code is</p>
  
  <pre><code>foreach file(`find . -type d | awk -F/ 'NF == 3'`) 
  echo $file
  set newmove = `echo $file | cut -c 1-2,5-`
  echo $newmove
  mv $file $newmove
  
  output:
  for find . -type d | awk -F/ 'NF == 3':
  ./24Jan2015/W51A
  `echo $file | cut -c 1-2,5-`
  ./Jan2015/W51A
  mv $file $newmove
  mv: cannot rename ./24Jan2015/W51A to   ./Jan2015/W51A: No such file or directory
  </code></pre>
  
  <p>but the script didnt work. 
  Do you guys have any idea how to do this? </p>