Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

I have 4 large USB devices with lots of backups collected over the years.

I want to search for all .Trash folders and delete the contents on Fedora 17. I tried the following which failed:-

    # find . -name ".Trash*"-exec rm -rf {} \;
    find: paths must precede expression: rm
    Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

Any hints appreciated!

share|improve this question
up vote 1 down vote accepted

To expand on @rkosegi's answer:

 # find . -depth -name ".Trash*" -exec rm -rf {} \;

Use -depth so that find doesn't try to descend the now deleted directory.

share|improve this answer
Or use -delete, which will automatically avoid this. – Chris Down Jun 15 '12 at 11:43

You missed space between name pattern and exec parameter:


 # find . -name ".Trash*"-exec rm -rf {} \;

Should be

 # find . -name ".Trash*" -exec rm -rf {} \;
share|improve this answer

Your Answer


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.