Re: Extract filename from path
- From: "William James" <w_a_x_man@xxxxxxxxx>
- Date: 11 Nov 2005 10:58:25 -0800
Jeroen Gouma wrote:
> Hi,
>
> How can I extract only the filename from the FILENAME variable,
> containing the complete path?
>
> i.e.:
> FILENAME = c:\test\input\data.txt
>
> I would like to have only data.txt in a variable.
>
> I was thinking on something like find the last \ in FILENAME and take
> a substr from there. But how to find the last \ if the lenght of the
> path can vary?
>
> Thanks a lot,
>
> Jeroen
fname=FILENAME; sub(/.*\\/, "",fname)
.
- References:
- Extract filename from path
- From: Jeroen Gouma
- Extract filename from path
- Prev by Date: Re: Help with arrays
- Next by Date: Re: Extract filename from path
- Previous by thread: Re: Extract filename from path
- Next by thread: Re: Extract filename from path
- Index(es):
Relevant Pages
|