/some/dir/foo
.for
-loop and testing at the onset that the first path given exists.fnmatch
function:fnmatch
which means it need only test if the first argument exists. If the first argument exists, an expansion was performed, otherwise the first argument remains a path to a non-existent, un-expandable pattern.fnmatch
as a method of testing whether a pathname containing patterns can successfully be expanded to one or more existing filesystem element(s):