71
11
Often I have a file name and it's partial path, e.g. "content/docs/file.xml".
Is there a simple way to search for that file, without manually cutting into parts its name to provide directory name and file name separately?
It'd be great if find
worked in that way, so I could run find content/docs/file.xml
, but unfortunately it doesn't.
1You could try adding a * wildcard at the beginning.
find -path *content/docs/file.xml
worked for me. – Bob – 2012-03-13T08:58:01.153thanks, @Bob, it's really worked for me. Btw, interesting, that if I'm adding a slash after an asterisk: "find -path */content/docs/file.xml", it doesn't work. Thanks a lot anyway. – None – 2012-03-13T09:06:48.023
also, @Bob, please make it as an answer and I'll mark it as a correct. – None – 2012-03-13T09:08:55.180
The reason the slash after asterisk didn't work is probably because the asterisk should have been escaped, see the edit to my answer. – Bob – 2012-03-13T10:55:46.390