[Haskell-cafe] How to move files?
Daniel Trstenjak
daniel.trstenjak at gmail.com
Thu Apr 15 08:23:34 UTC 2021
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
More information about the Haskell-Cafe
mailing list