[Haskell-cafe] How to move files?

☂Josh Chia (謝任中) joshchia at gmail.com
Thu Apr 15 09:27:57 UTC 2021

That would work but may not be the most efficient in all cases. On many
systems, /tmp is a tmpfs, which being memory-backed is more efficient than
a file on a physical disk or network, so writing to /tmp has performance

On Thu, Apr 15, 2021 at 4:23 PM Daniel Trstenjak <daniel.trstenjak at gmail.com>

> Hi Josh,
> the fastest and safest way is to create the temporary file in the
> directory of the final location and then move the file to its final name.
> This way you ensure that the temporary file is always on the same device
> or partition as the final file and therefore a move is always possible.
> And it's the safest, because a move is an atomic operation - which copy
> isn't - and therefore other processes will never see a partially updated
> file.
> Greetings,
> Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210415/fed152fc/attachment.html>

More information about the Haskell-Cafe mailing list