How to move a WordPress installation to a subdirectory

Move all your WP installation to the subdirectory, Then uodate in your DB (wp_options by default) the siteurl and home with the new url.
change https://example.com to https://example.com/blog

You need also to replace all ocurrences of example.com to example.com/blog in your DB manually, with SQL or with a plugin such Better Search Replace