Subject Re: Getting Just the File Name from Getfile()
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Tue, 22 May 2018 21:36:08 -0700
Newsgroups dbase.getting-started

On 5/22/2018 7:20 PM, Louis James wrote:
> Firstly assume that I am in the folder F:\Data\2018\03-2018
>
> if I use getfile(), in the following example:
>
>       f  = GETFILE("*Z*.xml","Select a File",.T.,"XML Files (*.xml)")
>
> I will get on the return something like:
>
> f = F:\Data\2018\03-2018\04-23-2018 The Long FileName.xml
>
> What I am interested in is JUST the filename without the path.  In this example:
>
> 04-23-2018 The LongFileName.xml
>
> How do I strip out the path and just get the filename.  Thank you for helping.

cFile = getfile( "*.xml" )
// for testing:
? cFile
// return only the filename from this string:
cFile = right( cFile, len(cFile)-rat("\",cFile))
// for testing:
? cFile


Ken
--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm