I don't use ArcGIS Notebooks much these days, so my assumption is there's some problem you're running into writing the zips to disk. I think you may be able to accomplish this in memory using a BytesIO object. I don't have immediate access to an FTP so I'm going to approximate this workflow using a web request, but the logic is pretty much the same.
Here is a working example of how to do the initial publish:
import requests
import io
from arcgis import GIS
zip_url = "https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_cd116_20m.zip"
r = requests.get(zip_url)
f = io.BytesIO()
f.write(r.content)
gis = GIS("https://arcgis.com/", "username", "pass")
item_properties = {
"type": "Shapefile",
"title": "test",
"fileName": "virtual_zip.zip"
}
shpfile = gis.content.add(item_properties, f)
published_service = shpfile.publish()
You can overwrite like this:
import requests
import io
from arcgis import GIS
from arcgis.features import FeatureLayerCollection
zip_url = "https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_cd116_20m.zip"
r = requests.get(zip_url)
f = io.BytesIO()
f.write(r.content)
gis = GIS("https://arcgis.com/", "username", "pass")
item_id = "d44e3b2892a54f25a11def293724acbc"
item = gis.content.get(item_id)
flc = FeatureLayerCollection.fromitem(item)
flc.manager.overwrite(f)
In your case, I think the for loop would change to something like this:
f = io.BytesIO()
ftp.retrbinary("RETR "+ zipfile, f.write)
f.seek(0)