So you have a "MainFolder" that has many files and directories, all of which you want to delete including any number of subdirectories and files contained therein, except for anything in FolderA (and obviously the MainFolder itself)?
You could try something like this:
Code:
for i in `find /path/to/MainFolder/* | grep -v "FolderA"`; do rm -rf $i; done
Let me add the disclaimer that any script where you forcefully and without confirmation delete files and folders should be run only after careful examination of the list of files/folders (from the "find" command) you are going to delete. And it's always a good idea to have everything backed up elsewhere in case something goes awry.