Get Direcotory Name without path

Please post here if you have problems in using Wing FTP Server.

Get Direcotory Name without path

Postby sinha_roop » Tue Jul 10, 2012 7:27 am

Re: User Variable
Thanks for your confirmation.

Since the answer is not affirmative so I want to put your attention to the real problem which I am fetching.

I want a write a script to send an email "onDirCreated" event under SSH event.
I am using c_SendMail() function for this in lua script.
In 'c_SendMail' parameter I want to pass the directory name(which has been created) for subject of that email.
I had tried following variables and its output as given below
Variables: - Output(subjectt Line)
%LastDir - Uploaded:/home/ebook1/FTP_QC/Tally1-CRX-Done/RH3942
%PathName - Uploaded:<nothing>
%Dir - Uploaded:/

Can you suggest how can I get only last directory name (RH3942)?
I am trying evaluation version wingFTP server in Linux OS (Ubuntu 10.04)
sinha_roop
 
posts 6
 
joined Mon Jul 09, 2012 10:36 am

Re: Get Direcotory Name without path

Postby FTP » Wed Jul 11, 2012 2:35 am

OK, if you use Lua script, you can get the filename with following script:

Code: Select all
local filepath = "%LastDir"
local filename = string.sub(filepath,string.len(filepath)-string.find(string.reverse(filepath),"/")+2)
FTP
Site Admin
 
posts 1212
 
joined Tue Sep 29, 2009 6:09 am


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests