Five Stars PK
Five Stars

how to get last folder name from directory

Hi,

I have directory like "

C:\Columbus\China\PRD\scripts\app\uploads\attachments\20000

 

From this directory i want to extract the last name i.e. 20000 as folder name.

 

Can someone help me to do it in talend.

 

Regards

PK

 

2 REPLIES
Twelve Stars TRF
Twelve Stars

Re: how to get last folder name from directory

Hi,

If number of characters is constant use StringHandling.RIGHT else check for regex

TRF
Five Stars PK
Five Stars

Re: how to get last folder name from directory

output_row.directory = (input_row.directory.substring(input_row.directory.lastIndexOf("\\")+1,input_row.directory.length()));

 

This worked for me Smiley Happy