"cd" to root of directory Y
then (assuming the folder name is "X", type in):
"find . -name X -exec rm -rf {} \;
" (and be incredibly careful about where you start this "find
" from... you only want to do this within your Y directory).
I do this kind of thing all the time to remove old/busted repository directories (like ".svn
"), which I suspect is what you may also be doing as well.
And now would probably be a smart time for me to remind you that "Time Machine" is a great thing to have enabled on your Macintosh.