You can share your Lua Scripts with everybody here.

Automatic decompress uploaded zip files

Sun Jan 03, 2010 2:22 pm

-- Description: Automatic decompress uploaded zip files
-- You should add the below scripts to the event manager -> FTP or HTTP OnFileUploaded
-- And I suppose you have installed WinRAR in the directory "C:\Program Files\WinRAR"
-- Author: Luke
-- Date: 2010-01-01

local fname = string.gsub("%PathName", "\\","/")
local dpath = string.sub(fname,0,string.len(fname)-4)
local ext = string.lower(string.sub(fname,-4))

if ext == ".rar" or ext == ".zip" or ext == ".tgz" then

os.execute("C:\\Progra~1\\WinRAR\\WinRAR x -Y \""..fname.."\" \""..dpath.."\\\" ")



Re: Automatic decompress uploaded zip files

Tue Mar 23, 2010 3:45 pm

This Script work great. The only question i have is if you can set this script to extract the files in the Archive to the root directory instead of creating another folder within the root directory.

Re: Automatic decompress uploaded zip files

Wed Mar 24, 2010 11:29 am

OK, you can make it, just replace the line:

local dpath = string.sub(fname,0,string.len(fname)-4)

into this:

local dpath = string.sub(fname,0,string.len(fname)-string.find(string.reverse(fname),"/"))

BTW, you may write lua script by yourself, it is not very hard.