
And how do we do it in the meantime? A search for "rename directory" comes up with 0 relevant results.

Hello,PB Fanatic wrote:And how do we do it in the meantime? A search for "rename directory" comes up with 0 relevant results.
What the? We have CreateDirectory, CopyDirectory, DeleteDirectory... but not RenameDirectory.Marc56us wrote:Use the keyword folder, instead of directory
I agree.PB Fanatic wrote:What the? We have CreateDirectory, CopyDirectory, DeleteDirectory... but not RenameDirectory.So searching for "directory" is therefore a totally logical thing to do
As result, the topic titled RenameFile() will be listed, which contains the following sentence:rename directory
Voilà!This function can also be used to rename/move directories.
Code: Select all
Procedure RenameDirectory(OldName.s, NewName.s)
ProcedureReturn RenameFile(OldName, NewName)
EndProcedure
Code: Select all
Macro RenameDirectory(old,new)
RenameFile(old,new)
EndMacro
old$=GetTemporaryDirectory()+"old"
Debug CreateDirectory(old$) ; 1 - Okay
Debug RenameDirectory(old$,"new") ; 0 - Fails
It works quite fine when doing it right...PB Fanatic wrote:A procedure or macro that wraps RenameFile() simply doesn't work
Code: Select all
Macro RenameDirectory(old,new)
RenameFile(old,new)
EndMacro
old$=GetTemporaryDirectory()+"old"
Debug CreateDirectory(old$) ; 1 - Okay
Debug RenameDirectory(old$,GetTemporaryDirectory()+"new") ; 1 - Okay
Small addition to Shardik's post:PB Fanatic wrote:A procedure or macro that wraps RenameFile() simply doesn't work: