title: Copy and Delete
body: <p>Ok, I am new to ubuntu. I have 200,000 files that I need to go through and archive files that have not been updated in 30days. </p>
  
  <pre><code>find . -type f -mtime +30
  </code></pre>
  
  <p>Done. </p>
  
  <p>Then I need to copy them to a location while keeping their dir structure past the current ./ This is because the file structure is part of the uniqueness of each file. I may have 200 files called sum however FunRun/Sum and Smoke/Sum are two different things.  </p>
  
  <pre><code>find . -type f -mtime +30 -exec cp --parents '{}' /home/me/backup \;
  </code></pre>
  
  <p>Done. But that does not delete them... Well mv is a cp with delete. But MV does not have --parents switch. </p>
  
  <p>So I tried </p>
  
  <pre><code>find . -type f -mtime +30 -exec cp --parents '{}' /home/me/backup \; &amp;&amp; rm
  for file in 'find . -type f -mtime +30' do sudo cp $file --parents '{}' /home/me/backup \; &amp;&amp; sudo rm $file; done
  </code></pre>
  
  <p>No go. So I was playing with creating a list of files and use it like old school batch files. Problem is the list takes a long time to make and I would like to automate this process. So I searched and tested nothing worked. So either a one-line bash script is a lost cause and will need to write a python script to do it or you guys can help. So I figured I would ask here and see how it goes over the weekend and test on monday. </p>
  
  <p>Thanks for your help. </p>