Page 1 of 1

Folder Name Integrity check using LUA

Posted: Sat May 11, 2013 11:33 am
by sinha_roop
Hi
I am using WINGFTP 4.0.9, Ubuntu 10.04.
With your support My FTP server is running since one year.
Now I want to give some more responsibilities to WingFTP server.

I have 2 users, both users share different directories.
e.g
User Name------------------Directory
User_Rtu-1--------------- /home/FOLDER/RTU1
User_Rtu-2--------------- /home/FOLDER/RTU2


'User_Rtu-2' creates a folder in their directory. After creating a new folder, this must be check in other directory (/home/FOLDER/RTU1). If that folder is present in that directory(/home/FOLDER/RTU1) then only folder will be created otherwise do not allow to create OR delete that folder in '/home/FOLDER/RTU2'.

Please advice how can I achieve the above requirement using LUA script.

Re: Folder Name Integrity check using LUA

Posted: Fri May 24, 2013 5:03 am
by sinha_roop
Hello Wing Team
Any Luck to view my post.

Re: Folder Name Integrity check using LUA

Posted: Fri May 24, 2013 4:46 pm
by FTP
OK, you can add the following script into the event "OnDirCreated -> Lua Script":

Code: Select all

local username = "%Name"
local dirpath = "%LastDir"
local dirname = string.sub(dirpath,string.len(dirpath)-string.find(string.reverse(dirpath),"/")+2)

if username == "User_Rtu-2" and c_IsDir("/home/FOLDER/RTU1/"..dirname) then
	c_RemoveFileDir(dirpath)
end