[Haskell-cafe] How to move files?
☂Josh Chia (謝任中)
joshchia at gmail.com
Thu Apr 15 04:32:16 UTC 2021
I'm trying to write to a temp file in /tmp and then move it to another
location that may be in /tmp.
If I use System.Directory.renameFile and the final location is in another
filesystem, I'll get an error "renameFile:renamePath:rename: unsupported
operation (Invalid cross-device link)".
If I copy to the new location and then remove the temp file, but the new
location is also in /tmp, I am doing an unnecessary copy (instead of mv),
which is inefficient.
I don't know how to detect whether two filepaths are in the same filesystem.
What's the best way to move the file if possible but copy-and-delete if
necessary?
Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210415/e73602f7/attachment.html>
More information about the Haskell-Cafe
mailing list