find -path Explained

find

The find command provides the option -path. I understand that one has to define where to start looking [commonly known as "path"]. Trying to figure out what it is used for, I found many examples using find -path -prune to exclude some paths.

Question: An explanation what find -path does; what this option is used for.

Please note: It seems crystal clear to me, but then doesn't work as I guessed it would. I worked through the man and the info pages, but I don't get the full meaning of this option.

EDIT As I understand it: find /some/path -name stuff should start looking for "stuff", starting in the directory path which is a subdirectory of some. Works. But then, what does the -path option define?
Definitions including sentences like

do not treat / or . specially

doesn't help much and are even more confusing.

Best Answer

-path does not (re)define the start path. It refers to the combination of the start path and the relative path of the currently examined object.

You may by this e.g. find all files within a subdirectory src no matter on which level.

"do not treat / or . specially" means that * can match both file names including the extension and into subdirectories: [...]/file* would match both /file.txt and /files/foo.bar

Related Question