Welcome! Log In Create A New Profile

Advanced

[WD] Directory ?

Posted by infos 
[WD] Directory ?
March 06, 2020 10:36AM
Hi all

sDirectory is string
sDirectory = fSelectDir("", "")

example
sDirectory = "H:\WINDEV 23\Programs\Rules"

How to extract only the "Rules" folder?

EDT_Directory = "Rules"

[infosonline.net]



Edited 1 time(s). Last edit at 03/06/2020 10:37AM by infos.
Re: [WD] Directory ?
March 06, 2020 10:57AM
Hi, that's easy. Find out whether the last character is a "\" and delete it. Next, find the number of "\" characters in the string. Then use extractstring(..) to extract the last string between "\"s.

Kind regards,
Guenter Predl
office@windev.at
Bruno
Re: [WD] Directory ?
March 06, 2020 11:07AM
Hi.

No validations done, but you can use something like:

ExtractString(fExtractPath(CompleteDir(sDirectory),fDirectory),2,"\",FromEnd)

Regards,

Bruno
Re: [WD] Directory ?
March 06, 2020 04:11PM
Yes, that's it

ExtractString(fExtractPath(CompleteDir(sDirectory),fDirectory),2,"\",FromEnd)



Thanks Bruno, Thanks Predl

[infosonline.net]
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: