title: Using find to delete all subdirectories (and their files)
body: <p>I'm sure this is straight forward and answered somewhere, but I didn't manage to find what I was looking for.  Basically, I'm trying to run a cron script to clear the contents of a given directory every 7 days.  So far I have tried the following,</p>
  
  <pre><code>find /myDir -mtime 7 -exec rm -rf {} \;
  </code></pre>
  
  <p>This however also deletes the parent directory myDir, which I do not want.  I also tried,</p>
  
  <pre><code>find /myDir -type f -type d -mtime 7 -delete
  </code></pre>
  
  <p>which appeared to do nothing.  I also tried,</p>
  
  <pre><code>fnd /myDir -type d -delete
  </code></pre>
  
  <p>which deleted all but the parent directory just as I need.  However, a warning message came up reading,</p>
  
  <blockquote>
    <p>relative path potentially not safe</p>
  </blockquote>
  
  <p>I'd appreciate if anyone can rectify my script so that it safely deletes all subdirectories in folder.  </p>
  
  <p>Many thanks. =)</p>
  
  <p><strong>UPDATE:</strong>  I decided to go for the following,</p>
  
  <pre><code>find /myDir -mindepth 1 -mtime 7 -delete
  </code></pre>
  
  <p>Based upon what I learned from all who replied.  Again, many thanks to you all.</p>