Page 1 of 1

Get Direcotory Name without path

Posted: Tue Jul 10, 2012 7:27 am
by sinha_roop
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)

Re: Get Direcotory Name without path

Posted: Wed Jul 11, 2012 2:35 am
by FTP
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)