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!

2 Answers 2


You missed space between name pattern and exec parameter:


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

Should be

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

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.

  • 3
    Or use -delete, which will automatically avoid this.
    – Chris Down
    Jun 15, 2012 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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