dirlist function

Discussions about creating CAPI applications to run on Android devices
Forum rules
New release: CSPro 8.0
Post Reply
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

dirlist function

Post by AriSilva »

The function returns a full qualified name, such as
/storage/emulated/0/data/gov.census..........................
Is there a way to get only the filename (with or without) the extension?
I´m trying to deal with a bunch of files in a certain directory, but it is a little bit difficult with the complete name.
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: dirlist function

Post by josh »

In CSPro 7.5 you can use path.GetFileName() or path.GetFilenameWithoutExtension() to get just the filename. In earlier versions you had to write your own versions of those functions that would search backwards through the string to get the last "/".
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Re: dirlist function

Post by AriSilva »

Thanks Josh, I did not know about these functions.
I was looking at the alphabetical list of functions and just did not see the use for them there (my fault).
Now, by looking at the what´s new in 7.5 I realize my mistake.
Next time I´ll pay more attention to that.
Best
Ari
Post Reply