A great way to clean up after you have exploded a tarball in the wrong place:

tar tf <file.tar.gz> | sort -r | while read file; do if [ -d "$file" ]; then rmdir "$file"; else rm -f "$file"; fi; done