How to import sql file in stored procedure in MySQL?
Not everything can be done in SQL.  In particular, it is not possible (without a UDF) to reach outside of MySQL to do file operations (other than LOAD FILE).  This is a security limitation.

The "right" way to deal with a requirement is to code it in your application language (PHP / Java / Python / ...).  Some steps would be SQL; some would be file operations.