01.04.2020, 11:23
Use this example to extract files from zip and read them:
Code:
zip = '/home/ftp/files.zip' -- source zip archive
if not io.exists(zip) then
alert('file not found')
return
end
dir = '/tmp/zip'
os.execute('rm -rf ' .. dir) -- clean-up
os.execute('mkdir ' .. dir) -- create dir
os.execute('unzip -qq -j "' .. zip .. '" -d ' .. dir) -- unzip
files = io.ls(dir) -- list file
for _, file in ipairs(files) do
data = io.readfile(dir .. '/' .. file)
log(file, data)
end
os.execute('rm -rf ' .. dir) -- clean-up