How to delete all the content of a wordpress site without deleting the Post and pages?

You can run this MySQL query to empty post content.

UPDATE wp_posts SET post_content="";

make sure you have a backup before you run this query, in case you need it later.
Also make sure that your MySQL table prefix is wp_.

Another Method.

You can also use WP_Query custom query to remove post content.

$args = array(
  'post_type' => array( 'post', 'page' ),
  'posts_per_page' => '-1',
);

$my_query = new WP_Query( $args );

if ( $my_query->have_posts() ) :
  while ( $my_query->have_posts() ) : $my_query->the_post();

    wp_update_post( array(
      'ID'            => get_the_id(),
      'post_content'   => '',
    ) );

  endwhile;
endif;

wp_reset_postdata();

You can use any of the above method. Both are working, just tested them.