add_action( 'init', 'mwp_delete_all_cpt_posts' );

function mwp_delete_all_cpt_posts() {
    
  $posts = get_pages( array( 'post_type' => 'your_custom_post_type') );
 
  foreach ( $posts as $post ) {
        
    // Delete all post from custom post type.
        
    wp_delete_post( $post->ID, true); // Set to False if you want to send them to Trash.
  
  } 

}