title: Linux project: bash script to archive and remove files
body: <p>I've been set a mini project to run a bash script to archive and remove files that are older than 'x' number of days. The file will be archived in the /nfs/archive directory and they need to be compressed (TAR) or removed... e.g. '/test.sh 15' would remove files older than 15 days. Moreover, I also need to input some validation checking before removing files...</p>
  
  <p>My code so far: </p>
  
  <pre><code>&gt; #!/bin/bash 
  &gt; 
  &gt; #ProjectEssentials:
  &gt; 
  &gt; # TAR: allows you to back up files
  &gt; # cronjob: schedule taks 
  &gt; # command: find . -mtime +('x') -exec rm {} \; this will remove files older than 'x' number of days 
  &gt; 
  &gt; find /Users/alimohamed/downloads/nfs/CAMERA -type f -name '*.mov'
  &gt; -mtime +10 -exec mv {} /Users/limohamed/downloads/nfs/archive/ \;
  &gt; 
  &gt; # TAR: This will allow for the compression
  &gt; 
  &gt; tar -cvzf doc.tar.gz /Users/alimohamed/downloads/nfs/archive/
  &gt; 
  &gt; # Backup before removing files 'cp filename{,.bak}'?  find /Users/alimohamed/downloads/nfs/CAMERA -type f name '*.mov' -mtime +30
  &gt; -exec rm {} \; ~
  </code></pre>
  
  <p>Any help would much appreciated!!</p>