# Wildcard directory exclusions with robocopy — weird case

I need to get robocopy to exclude any file whose path contains a directory with a particular name. For example, "bar":

c:\foo\bar\a.txt
c:\bar\c.txt
d:\baz\bar\flub\d.txt


should be excluded, but not

c:\foo\barf\b.txt


Here are the things I tried -- each of which was rejected by robocopy:

/XD \bar\
/XD *\bar\*
/XD *^\bar^\*


Any ideas?

-