Rename File

Discussions related to Visual Prolog
Loffy
Posts: 22
Joined: 15 Aug 2019 11:32

Rename File

Unread post by Loffy » 21 Aug 2019 9:07

I have tried to find a replacement for the old renamefile/2 predicate without luck so far.

Any hints?

Regards,

Loffy

Harrison Pratt
VIP Member
Posts: 302
Joined: 5 Nov 2000 0:01

Re: Rename File

Unread post by Harrison Pratt » 21 Aug 2019 12:25

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

Loffy
Posts: 22
Joined: 15 Aug 2019 11:32

Re: Rename File

Unread post by Loffy » 21 Aug 2019 12:41

Harrison,

Thanks again.

Regards,

Loffy

Post Reply