[fpc-pascal] Problems with moving/renaming file using sysutils.renamefile

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Feb 10 13:41:05 CET 2012


On 10 Feb 2012, at 13:31, Reinier Olislagers wrote:

> 1. Renaming is not moving???
> The help says:
> "RenameFile renames a file from OldName to NewName. The function  
> returns
> True if successful, False otherwise. Remark: you cannot rename across
> disks or partitions."
> What does this mean, then?
> If you rename from e.g. /etc/b to /var/b, (and assuming they're on the
> same partition), you're moving the files from one directory to  
> another,
> aren't you?

At the level of the filesystem, that is also a rename operation.

> 2. What is the function for "properly" moving files in FPC that also
> moves between partitions, if one exists?

I don't think there is one.

> Or a file copy routine (I've found only Lazarus fileutil.Copyfile)?  
> And
> could a link to that be put in the RenameFile help?

You indeed have to copy the file and then delete the original one in  
that case. I don't know whether there is a copyfile routine in the RTL.


Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120210/9802fe7d/attachment.html>


More information about the fpc-pascal mailing list