<div dir="ltr">I'm trying to write to a temp file in /tmp and then move it to another location that may be in /tmp.<div><br></div><div>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)".</div><div><br></div><div>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.</div><div><br></div><div>I don't know how to detect whether two filepaths are in the same filesystem.</div><div><br></div><div>What's the best way to move the file if possible but copy-and-delete if necessary?</div><div><br></div><div>Josh</div></div>