I would use the find command and use the -exec option in the expression.
Test this first to make sure that it's finding the correct directories and you get no false positives. Change into the directory you're wanting to start from and then type:
find . -type d -iname x
That should do a case insensitive search for all directories named "x" from the current working directory and recurse down. If the output of that looks correct, you can delete files in those directories by issuing the following:
find . -type d -iname x -exec rm {}/* \+
This will delete only the files contained in the directories named "x". If you wish to delete the "x" directories as well, use the following:
find . -type d -iname x -exec rm -Rf {} \+