If you want to customise how the current process works have a look at the https://github.com/pycom/pycom-micropython-sigfox/tree/master/esp32/ftp folder, especially updater.c.