Page 1 of 1
Rename File
Posted: 21 Aug 2019 9:07
by Loffy
I have tried to find a replacement for the old renamefile/2 predicate without luck so far.
Any hints?
Regards,
Loffy
Re: Rename File
Posted: 21 Aug 2019 12:25
by Harrison Pratt
See file::
move/2 and
file::move/3
Code: Select all
move : (
string Filename,
string Destination).
Moves file to another location.
Description
The predicate moves(renames) a file specified by Filename to the location, specified by Destination path.
If Destination is a new file name, then the file will be moved to a new location and renamed simultaneously, otherwise it's assumed that Destination is an existing directory and the file will be moved into it.
If Destination already contains file with the same name, then the file will be overwritten.
Both names may have the full-qualified or relative paths.
Exceptions
nativeCallException is raised if internal API function call failed
Re: Rename File
Posted: 21 Aug 2019 12:41
by Loffy
Harrison,
Thanks again.
Regards,
Loffy
Re: Rename File
Posted: 19 Nov 2019 13:28
by Tonton Luc
Hi,
You can also use :
Code: Select all
fileName::setName("C:\\myFolder\\oldName.txt","NewName"),
Re: Rename File
Posted: 19 Nov 2019 22:39
by Harrison Pratt
setName/2 only changes a string containing a fully qualified file name. It doesn't do anything to a file.
It belongs to the same family of functions as setPath/2and setExtension/2.