I'd like to use
find to match a path but I found this:
File name matches shell pattern pattern. The metacharacters do not treat
/' or.' specially; so, for example,
find . -path "./sr*sc"
will print an entry for a directory called
./src/misc(if one exists).
How can I make it only match files in the current dir? Do I need another tool for this job?
Edit. As suggested here's some details. To do this job there are
-regex for use. However, in real applications the path may be a variable instead of a simple constant here, where
-maxdepth won't work well and
-regex may look like an overkill. So I'd like to know if there is a simple solution with
find to make it respect slash. Below is rsync doc describing its behavior which is very close to what I want.
Currently best solution is using regex, but if you know anything that can make it simpler that'd be welcome.
As an example of what I want, here is rsync pattern rule:
a ’*’ matches any path component, but it stops at slashes.
use ’**’ to match anything, including slashes.