Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
find . -path '/mnt/ftp/ben/brc' -prune -o -iregex '.*\.\(docx\|xls\|txt\|pdf\|xlsm\|doc\|xlsx\|CVS\|csv\)$'  -mtime +730  -delete

I need all docx, xls, txt, xlms, doc files older than 2 years from my ftp server but also want to exclude /mnt/ftp/ben/brc directory. How can I achieve that?

share|improve this question

Try this

find . -path '/mnt/ftp/ben/brc' -prune -o -iregex '.*\.\(docx\|xls\|txt\|pdf\|xlsm\|doc\|xlsx\|CVS\|csv\)$'  -mtime +730  -print0 | xargs -0 rm
share|improve this answer
    
find . -path '/mnt/ftp/ben/brc' -prune -o -iregex '.*\.(docx\|xls\|txt\|pdf\|xlsm\|doc\|xlsx\|CVS\|csv)$' -mtime +730 -print0 | xargs -0 rm rm: missing operand Try 'rm --help' for more information – user37664 May 6 '13 at 15:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.