Folder Name Integrity check using LUA

You can share your Lua Scripts with everybody here.
Post Reply
sinha_roop
Posts: 7
Joined: Mon Jul 09, 2012 10:36 am

Folder Name Integrity check using LUA

Post 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.
sinha_roop
Posts: 7
Joined: Mon Jul 09, 2012 10:36 am

Re: Folder Name Integrity check using LUA

Post by sinha_roop »

Hello Wing Team
Any Luck to view my post.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Folder Name Integrity check using LUA

Post 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
Post Reply