[Gambas-user] Please help with directory problem
Doriano Blengino
doriano.blengino at ...1909...
Sat Nov 1 08:19:53 CET 2008
Kari Laine ha scritto:
> On Fri, Oct 31, 2008 at 2:57 PM, Benoit Minisini <
> gambas at ...1...> wrote:
>
>
>> On vendredi 31 octobre 2008, Kari Laine wrote:
>>
>>> Thanks Benoit !
>>>
>> I often forget the WAIT keyword after a SHELL or EXEC command, so now I
>> think
>> this syntax was not a really good idea.
>>
>> I should have used the opposite syntax, i.e. a keyword like "BACKGROUND"
>> or "DO NOT WAIT"!
>>
>>
>>
> Hi,
>
> I still have a problem.
> The routine is now following
>
> PUBLIC SUB makedirs(sHak AS String)
> DIM haks AS NEW String[300]
> DIM hak2 AS String
> DIM crtdir AS String
>
> crtdir = "/home/kari/backup_work/cdroot/"
> haks = Split(sHak, "/")
> FOR EACH hak2 IN haks
> IF hak2 = "" THEN CONTINUE
>
> crtdir = crtdir &/ hak2
> 'SHELL "mkdir " & crtdir
> 'TRY MKDIR crtdir
> SHELL "mkdir " & crtdir WAIT
>
> 'PRINT crtdir
> NEXT
>
> END
>
Anyway, why don't you use a simpler "mkdir -p ...."?
I read your other subsequent message too, about the error, and noticed
you solved.
So, you *can* work out by gambas code, and your task is done.
This is not a "gambas" suggestion, but in the end a "mkdir -p" is
cleaner, easier, and faster...
Right after a "mkdir -p ..." you can test for the directory existance,
to see if all went well.
Cheers,
Doriano
More information about the User
mailing list