I have to move some files from one filesystem to another under Ubuntu. However, it is very important that the files never exist as partial or incomplete files at the destination, at least not under the correct file name.
So far, my only solution is to write a script that takes each file, copies it to a temporary name at the destination, then renames it (which I believe should be atomical) at the destination to the original filename and finally deletes the originating file.
However, writing and debugging a script seems like it is overkill for this task. Is there a way or tool that already does this natively?
Accordingly, it is necessary that each file, if it exists in any of the locations, needs to be complete and intact. Otherwise, there exists a race condition between a transfer starting and ending where a cache might grab (and retain) an incomplete file.
– Niels2000 Dec 22 '17 at 12:43