title: Need to delete a large number of files
body: <p>I need to delete a large number of files located in a specific folder (<code>wc</code> command is retrieving around <code>2392934</code>). The folder contains files of both years 2015 &amp; 2016. I want to only delete files of 2015 and for that I have created this script:</p>
  
  <pre><code>echo 'going to given path'
  cd /usr/local/nagios/var/spool/xidpe/
  pwd
  b=$(ls -lrt | grep '2015' | awk '{print $9}')
  echo 'listen tail outcome'
  echo 'going to del'
  rm -rf $b
  exit
  </code></pre>
  
  <p>But it returns this error message:</p>
  
  <pre><code>./test.sh: line 10: /bin/rm: Argument list too long
  </code></pre>
  
  <p>I have tried <code>xargs</code> also:</p>
  
  <pre><code>b=$(ls -lrt | xargs '2016' | awk '{print $9}')
  </code></pre>
  
  <p>But it returns this error message:</p>
  
  <pre><code>xargs: 2016: No such file or directory
  </code></pre>
  
  <p>Is there any changes need to be done in my script or any other ways to delete these files (only for year 2015)?</p>