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

file::move/2
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