Lazarus
Free Pascal => Beginners => Topic started by: JLWest on January 23, 2021, 04:53:45 am
Title:
(Solved)Rename Directory
Post by:
JLWest
on
January 23, 2021, 04:53:45 am
Is there a function to rename a directory. I see nothing in fileutils or Lazfileutils.
Thanks
Title:
Re: Rename Directory
Post by:
lucamar
on
January 23, 2021, 05:54:29 am
A shot in the dark but, have you tried whether any of the
RenameFile()
or
RenameFileUTF8()
functions work if you pass them a directory name?
Title:
Re: Rename Directory
Post by:
trev
on
January 23, 2021, 07:28:21 am
This works for me in FreeBSD and macOS and Windows 10:
Code: Pascal
[Select]
[+]
[-]
program
renamedir
;
uses
sysutils
;
begin
if
(
renamefile
(
'testdir1'
,
'testdir2'
)
)
then
WriteLn
(
'Rename succeeded!'
)
else
WriteLn
(
'Rename failed!'
)
;
end
.
Title:
Re: Rename Directory
Post by:
JLWest
on
January 23, 2021, 08:22:52 am
Thanks I'll try in the morning.
TinyPortal
© 2005-2018