I'm trying to use find with the regex option. However my regular expression only captures the basename of the file. Is there a reference to the "directory find is currently in" I can use in my regular expression so that I don't have to account for it by means of a leading .*?
(I'm looking for something like the $File::Find::dir in perl's File::Find module.)
As an example: suppose I want to find all files matching the regular expression baz\d anywhere below /foo/bar/. Using find /foo/bar -regex 'baz\d' won't find a file named baz1 at /foo/bar/ because the pattern baz\d doesn't match the full filename /foo/bar/baz1, so instead I'm using find /foo/bar -regex '.*baz\d' which works, but I'm wondering whether I can replace that .* with something more robust?
findmay fall under? – Isaac Kleinman Dec 4 '12 at 20:57