Server Fault is a question and answer site for system and network administrators. 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

I have some files in the filesystem that end with a trailing slash like so:


I usually use find for these cases, but the following did not work:

find . -name "*\\"

Anybody have any ideas? Thanks

share|improve this question
up vote 5 down vote accepted

You can double-escape it or use single quotes:

find . -name "*\\\\" -print
find . -name '*\\' -print
share|improve this answer
Nice. Exactly what i need. While I wait 9 mins to accept your answer... can you explain why i need to double escape? – denormalizer Apr 27 '11 at 7:09
@superspace: It's the difference between single and double quotes in bash (and I think any other shell). In double quoted strings, it will still expand meta characters, so it would have first turned \` into ` as you expect. However that is then passed to find as "*\", where find expands it again. \" is a literal " character, leaving find looking for files matching "*". Double-escaping gets around that the fun way; and using single quotes tells the shell to pass everything on to the command unchanged. – SmallClanger Apr 27 '11 at 8:37

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.