11.09.2023, 16:13
Try this, you need 2023 firmware for it to work. Change variables in the first 4 lines as needed.
Code:
host = 'FTP_SERVER_IP'
user = 'username'
pass = 'password'
path = 'backup-' .. os.date('%Y-%m-%d') .. '.zip'
ftp = require('socket.ftp')
ltn12 = require('ltn12')
webrequest = require('webrequest')
data = webrequest('general', 'backup')
res, err = ftp.put({
host = host,
user = user,
password = pass,
argument = path,
source = ltn12.source.string(data)
})
if not res then
log('ftp upload failed: ' .. tostring(err))
end