Folder Name Integrity check using LUA

You can share your Lua Scripts with everybody here.

Folder Name Integrity check using LUA

Postby sinha_roop » Sat May 11, 2013 11:33 am

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 6
 
joined Mon Jul 09, 2012 10:36 am

Re: Folder Name Integrity check using LUA

Postby sinha_roop » Fri May 24, 2013 5:03 am

Hello Wing Team
Any Luck to view my post.
sinha_roop
 
posts 6
 
joined Mon Jul 09, 2012 10:36 am

Re: Folder Name Integrity check using LUA

Postby FTP » Fri May 24, 2013 4:46 pm

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
FTP
Site Admin
 
posts 1232
 
joined Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: Google [Bot] and 1 guest