Get Direcotory Name without path

Please post here if you have problems in using Wing FTP Server.
Post Reply
sinha_roop
Posts: 7
Joined: Mon Jul 09, 2012 10:36 am

Get Direcotory Name without path

Post 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)
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Get Direcotory Name without path

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