Alaska Software Inc. - Rename Directory
Username: Password:
AuthorTopic: Rename Directory
Zdenko BielikRename Directory
on Fri, 28 Jan 2011 16:22:36 +0100
Hi,

I can't find in doc/help any function for renaming directories.
Can someone open my eyes and tell me name of that function...?
Or share any code for direct calling Win API DLL function?

TIA & Regards

    Zdeno


s pozdravom

zdeno bielik
ace system, spol. s r.o.
tiavnick 18
949 01 nitra
http://www.acesystem.sk
tel: 0904 - 328 888

... s nami dostvate vdy viac
Don Keating Re: Rename Directory
on Fri, 28 Jan 2011 17:34:10 -0500
Zdeno

Have you tried DirMake() in Xbtools.

   >don<

On Fri, 28 Jan 2011 16:22:36 +0100, Zdenko Bielik wrote:

> Hi,
> 
> I can't find in doc/help any function for renaming directories.
> Can someone open my eyes and tell me name of that function...?
> Or share any code for direct calling Win API DLL function?
> 
> TIA & Regards
> 
>     Zdeno
> 
> 
> s pozdravom
> 
> zdeno bielik
> ace system, spol. s r.o.
> ¹tiavnická 18
> 949 01 nitra
> http://www.acesystem.sk
> tel: 0904 - 328 888
> 
> ... s nami dostávate v¾dy viac
Hubert BrandelRe: Rename Directory
on Sat, 29 Jan 2011 16:23:37 +0100
Hi,

use the same as for files !

RENAME ... TO ..  will work.

But be carefull, no open files, CMD Boxes or explorers are allowed 
inside the directory to be renamed. Did you need to MOVE a file ?

Try

RENAME c:\test\test.dbf TO c:\old\back_test.dbf

it will move and rename the file, if the directories exists.

Example:

proc main
    local cOld := "c:\temp\test1"
    local cNew := "c:\temp\test2"
    ? createdir(cOld)
    ? fexists(cOld,"D"), fexists(cNew,"D")
    rename (cOld) to (cNew)
    ? fexists(cOld,"D"), fexists(cNew,"D")
    wait
    ? removeDir(cOld)
return

Result:

C:\temp>test

J
J J
J J
Press any key to continue...
J
C:\temp>
Zdenko BielikRe: Rename Directory
on Mon, 31 Jan 2011 11:36:04 +0100
> use the same as for files !
>
> RENAME ... TO ..  will work.

Hi Hubert,

I didn't know that FRename() works also in this way.
Many thanks for this tip - it works!
May be Alaska can add info about this behavior of this function in help/doc 
too...

     Zdeno